本文整理汇总了Java中org.springframework.jms.listener.DefaultMessageListenerContainer.setDestinationName方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultMessageListenerContainer.setDestinationName方法的具体用法?Java DefaultMessageListenerContainer.setDestinationName怎么用?Java DefaultMessageListenerContainer.setDestinationName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.jms.listener.DefaultMessageListenerContainer
的用法示例。
在下文中一共展示了DefaultMessageListenerContainer.setDestinationName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: responder
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@Bean
public DefaultMessageListenerContainer responder() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(connectionFactory());
container.setDestinationName("test.out");
MessageListenerAdapter adapter = new MessageListenerAdapter(new Object() {
@SuppressWarnings("unused")
public String handleMessage(String in) {
return in.toUpperCase();
}
});
container.setMessageListener(adapter);
return container;
}
示例2: messageListener
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@Bean
public DefaultMessageListenerContainer messageListener() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(this.connectionFactory);
container.setDestinationName("testQueue");
container.setMessageListener(new MessageListener() {
@Override
public void onMessage(Message message) {
try {
System.out.println(message.getBody(Object.class));
}
catch (JMSException ex) {
ex.printStackTrace();
}
}
});
return container;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:SampleHornetQApplication.java
示例3: init
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@Override
public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception {
final AnalyticServiceServer server = new AnalyticServiceServer(getViewProcessor(), getPositionMaster(), getPortfolioMaster(), getConfigSource());
server.setUser(getUser());
server.setViewName(getViewName());
server.setProviderIdName(getProviderIdName());
AnalyticServiceTradeProducer tradeProducer = new AnalyticServiceTradeProducer();
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setMessageListener(
new JmsByteArrayMessageDispatcher(
new ByteArrayFudgeMessageReceiver(tradeProducer)));
container.setDestinationName(getListenTopicName());
container.setPubSubDomain(false);
container.setConnectionFactory(getListenJmsConnector().getConnectionFactory());
JmsAnalyticsDistributor analyticsDistributor = new JmsAnalyticsDistributor(new DefaultJmsTopicNameResolver(getPositionSource()), OpenGammaFudgeContext.getInstance(), _listenJmsConnector);
server.setAnalyticResultReceiver(analyticsDistributor);
server.setTradeProducer(tradeProducer);
repo.registerLifecycle(server);
repo.registerLifecycle(container);
}
示例4: setUpClass
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@BeforeClass
public void setUpClass() {
JmsConnector jmsConnector = ActiveMQTestUtils.createTestJmsConnector();
_factory = new JmsSenderFactory(jmsConnector);
_mdd = MarketDataDistributorTest.getTestDistributor(_factory);
_collectingReceiver = new CollectingByteArrayMessageReceiver();
JmsByteArrayMessageDispatcher messageDispatcher = new JmsByteArrayMessageDispatcher(_collectingReceiver);
_container = new DefaultMessageListenerContainer();
_container.setConnectionFactory(jmsConnector.getConnectionFactory());
_container.setMessageListener(messageDispatcher);
_container.setDestinationName(_mdd.getDistributionSpec().getJmsTopic());
_container.setPubSubDomain(true);
_container.afterPropertiesSet();
_container.start();
}
示例5: startListener
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
public void startListener() {
MessageListenerAdapter messageListenerAdapter = new MessageListenerAdapter();
messageListenerAdapter.setDelegate(this);
messageListenerAdapter.setMessageConverter(mqMessageConverter);
DefaultMessageListenerContainer mqListener = new DefaultMessageListenerContainer();
mqListener.setConnectionFactory(mqConnectionFactory.getFactory());
mqListener.setDestinationName(appConfig.getMqQueueName());
mqListener.setMessageListener(messageListenerAdapter);
mqListener.setConcurrency("4-8");
mqListener.setSessionTransacted(true);
mqListener.initialize();
mqListener.start();
}
示例6: registerMessageListener
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
public void registerMessageListener(MessageListener listener,
String destinationName)
{
log.info("registerMessageListener(" + destinationName + ", " + listener + ")");
container = new DefaultMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setDestinationName(destinationName);
container.setMessageListener(listener);
container.setTaskExecutor(taskExecutor);
container.afterPropertiesSet();
container.start();
listenerContainerMap.put(listener, container);
}
示例7: messageListener
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@Bean
public DefaultMessageListenerContainer messageListener() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(this.connectionFactory);
container.setDestinationName(queue);
container.setMessageListener(new Consumer());
return container;
}
示例8: serverRequestListenerContainer
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@Bean
public DefaultMessageListenerContainer serverRequestListenerContainer() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(singleConnectionFactory());
container.setDestinationName("replaced-at-runtime");
container.setSessionTransacted(false);
container.setMaxMessagesPerTask(1);
container.setReceiveTimeout(1000);
container.setIdleTaskExecutionLimit(10);
container.setAutoStartup(false);
return container;
}
示例9: secondServerRequestListenerContainer
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@Bean
public DefaultMessageListenerContainer secondServerRequestListenerContainer() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(secondSingleConnectionFactory());
container.setDestinationName("replaced-at-runtime");
container.setSessionTransacted(false);
container.setMaxMessagesPerTask(1);
container.setReceiveTimeout(1000);
container.setIdleTaskExecutionLimit(10);
container.setAutoStartup(false);
return container;
}
示例10: buildListenerContainer
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
/**
* 构建基于队列模式的消息监听容器
*
* @param queueName 队列名字
* @param rpcServiceExport 服务暴露接口
* @return
*/
protected MessageListenerContainer buildListenerContainer(JmsInvokerServiceExporter rpcServiceExport,
String queueName) {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(jmsConnectionFactory());
container.setDestinationName(queueName);
container.setMessageConverter(messageConverter());
container.setMessageListener(rpcServiceExport);
container.setConcurrentConsumers(Runtime.getRuntime().availableProcessors());
return container;
}
示例11: mqMessageReceiver
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
/**
* 配置基于发布订阅模式的消息监听容器,用于接收MQ转发过来的消息
*
* @param topicName
* @param messageListener
* @return
*/
public MessageListenerContainer mqMessageReceiver(String topicName, MessageListener messageListener) {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(jmsConnectionFactory());
container.setDestinationName(topicName);
container.setPubSubDomain(true);
container.setPubSubNoLocal(true);
container.setMessageListener(messageListener);
container.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);
return container;
}
示例12: init
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@Override
public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception {
LastKnownValueStoreProvider lkvStoreProvider =
CogdaFactoryUtil.constructLastKnownValueStoreProvider(
getDataRedisServer(),
getDataRedisPort(),
getDataRedisPrefix(),
false,
s_logger);
CogdaLiveDataServer liveDataServer = new CogdaLiveDataServer(lkvStoreProvider);
if (getListenPort() != null) {
liveDataServer.setPortNumber(getListenPort());
}
liveDataServer.registerMetrics(OpenGammaMetricRegistry.getSummaryInstance(), OpenGammaMetricRegistry.getDetailedInstance(), "CogdaLiveDataServer");
CogdaLiveDataServerUpdateListener updateListener = new CogdaLiveDataServerUpdateListener(liveDataServer);
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setMessageListener(
new JmsByteArrayMessageDispatcher(
new ByteArrayFudgeMessageReceiver(updateListener)));
container.setDestinationName(getListenTopicName());
container.setPubSubDomain(true);
container.setConnectionFactory(getListenJmsConnector().getConnectionFactory());
CogdaLiveDataServerMBean mbean = new CogdaLiveDataServerMBean(liveDataServer);
repo.registerLifecycle(liveDataServer);
repo.registerLifecycle(container);
repo.registerMBean(mbean);
}
示例13: listenerContainer
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@Bean
public AbstractMessageListenerContainer listenerContainer() {
final DefaultMessageListenerContainer defaultMessageListenerContainer = new DefaultMessageListenerContainer();
defaultMessageListenerContainer.setConnectionFactory(connectionFactory());
defaultMessageListenerContainer.setConcurrency(listenerContainerConcurrency);
defaultMessageListenerContainer.setDestinationName(queueName);
defaultMessageListenerContainer.setMessageListener(queueListener());
return defaultMessageListenerContainer;
}
示例14: defaultMessageListenerContainer
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@Bean
public DefaultMessageListenerContainer defaultMessageListenerContainer(MessageListener messageListener, ConnectionFactory connectionFactory, Log log) {
log.info("serve DefaultMessageListenerContainer");
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setDestinationName("test");
container.setMessageListener(messageListener);
return container;
}
示例15: deleteContainer
import org.springframework.jms.listener.DefaultMessageListenerContainer; //导入方法依赖的package包/类
@Bean
DefaultMessageListenerContainer deleteContainer(MessageListenerAdapter deleteListenerAdapter,
ConnectionFactory connectionFactory) {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setMessageListener(deleteListenerAdapter);
container.setConnectionFactory(connectionFactory);
container.setDestinationName(deleteDocumentsQueueName);
return container;
}