本文整理汇总了Java中org.hornetq.api.jms.HornetQJMSClient类的典型用法代码示例。如果您正苦于以下问题:Java HornetQJMSClient类的具体用法?Java HornetQJMSClient怎么用?Java HornetQJMSClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HornetQJMSClient类属于org.hornetq.api.jms包,在下文中一共展示了HornetQJMSClient类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: hornetQMessageListenerContainer
import org.hornetq.api.jms.HornetQJMSClient; //导入依赖的package包/类
@Bean
public MessageListenerContainer hornetQMessageListenerContainer() {
Map<String, Object> map = new HashMap<String, Object>();
map.put(TransportConstants.HOST_PROP_NAME, hornetq_host);
map.put(TransportConstants.PORT_PROP_NAME, hornetq_port);
TransportConfiguration transportConfiguration =new TransportConfiguration(
NettyConnectorFactory.class.getName(), map);
HornetQConnectionFactory hornetQConnectionFactory = HornetQJMSClient.createConnectionFactoryWithoutHA(
JMSFactoryType.CF, transportConfiguration);
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory((ConnectionFactory) hornetQConnectionFactory);
container.setDestination(HornetQJMSClient.createTopic(IMConstant.GATEWAY_USERREGISTER_TOPIC));
container.setPubSubDomain(true);
container.setPubSubNoLocal(true);
container.setMessageListener(userRegisterListener);
container.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);
return container;
}
开发者ID:projectsrepos,项目名称:jim,代码行数:21,代码来源:GatewayUserRegisterConfig.java
示例2: createRemoteConnectionFactory
import org.hornetq.api.jms.HornetQJMSClient; //导入依赖的package包/类
protected ConnectionFactory createRemoteConnectionFactory(final Options<CreateContextOption> options) {
//TODO: possibly cache the remote cf's?
Map<String, Object> transportOpts = new HashMap<>();
transportOpts.put("host", options.getString(CreateContextOption.HOST));
transportOpts.put("port", options.getInt(CreateContextOption.PORT));
if (REMOTE_TYPE_WILDFLY.equals(options.getString(CreateContextOption.REMOTE_TYPE))) {
transportOpts.put("http-upgrade-enabled", true);
}
TransportConfiguration config =
new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory",
transportOpts);
HornetQConnectionFactory hornetQcf = HornetQJMSClient
.createConnectionFactoryWithoutHA(options.has(CreateContextOption.XA) ?
JMSFactoryType.XA_CF :
JMSFactoryType.CF,
config);
hornetQcf.setReconnectAttempts(options.getInt(CreateContextOption.RECONNECT_ATTEMPTS));
hornetQcf.setRetryInterval(options.getLong(CreateContextOption.RECONNECT_RETRY_INTERVAL));
hornetQcf.setRetryIntervalMultiplier(options.getDouble(CreateContextOption.RECONNECT_RETRY_INTERVAL_MULTIPLIER));
hornetQcf.setMaxRetryInterval(options.getLong(CreateContextOption.RECONNECT_MAX_RETRY_INTERVAL));
// We have to cast for HornetQ 2.3 - the factory object that is returned is both a HornetQConnectionFactory
// and a javax.jms.ConnectionFactory, but HornetQConnectionFactory doesn't implement j.j.ConnectionFactory.
// With HornetQ 2.4, this cast is redundant.
return (ConnectionFactory)hornetQcf;
}
开发者ID:projectodd,项目名称:wunderboss,代码行数:29,代码来源:HQMessaging.java
注:本文中的org.hornetq.api.jms.HornetQJMSClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论