List of usage examples for org.springframework.jms.listener.adapter MessageListenerAdapter setDefaultListenerMethod
public void setDefaultListenerMethod(String defaultListenerMethod)
From source file:io.fabric8.quickstarts.activemq.App.java
@Bean MessageListenerAdapter adapter(Receiver receiver) { MessageListenerAdapter messageListener = new MessageListenerAdapter(receiver); messageListener.setDefaultListenerMethod("receiveMessage"); return messageListener; }
From source file:com.rabbitmq.jms.sample.StockConsumer.java
@Bean public DefaultMessageListenerContainer jmsListener(ConnectionFactory connectionFactory) { log.info("connectionFactory => " + connectionFactory); DefaultMessageListenerContainer jmsListener = new DefaultMessageListenerContainer(); jmsListener.setConnectionFactory(connectionFactory); jmsListener.setDestinationName("rabbit-trader-channel"); jmsListener.setPubSubDomain(false);/*from w w w . j a va 2 s . c om*/ MessageListenerAdapter adapter = new MessageListenerAdapter(new Receiver()); adapter.setDefaultListenerMethod("receive"); jmsListener.setMessageListener(adapter); return jmsListener; }
From source file:org.nebulaframework.grid.cluster.manager.services.jobs.splitaggregate.AggregatorServiceImpl.java
/** * Internal method which handles the aggregator start-up for * a given {@code GridJobProfile}./*www . jav a 2 s. c o m*/ * <p> * Creates and starts a {@code ResultCollector} instance for * the given {@code GridJob}, and also creates necessary JMS message * handling infrastructure. * * @param profile {@code GridJobProfile} jobProfile */ protected void doStartAggregator(GridJobProfile profile, SplitAggregateJobManager manager) { // Create Message Listener Adapter and Result Collector for Job MessageListenerAdapter adapter = new MessageListenerAdapter(); adapter.setDefaultListenerMethod("onResult"); // Create JMS Message Listener Container DefaultMessageListenerContainer container = new DefaultMessageListenerContainer(); container.setConnectionFactory(connectionFactory); container.setDestinationName(JMSNamingSupport.getResultQueueName(profile.getJobId())); container.setMessageListener(adapter); //Create results collector and set it as Execution Manager ResultCollector collector = new ResultCollector(profile, manager, container); profile.setExecutionManager(manager); manager.addResultCollector(profile.getJobId(), collector); // Initialize Adapter and Container adapter.setDelegate(collector); container.afterPropertiesSet(); }
From source file:org.nebulaframework.grid.cluster.manager.services.jobs.unbounded.UnboundedJobProcessor.java
/** * Register's {@link #onResult(GridTaskResult)} method as the listener * method for ResultQueue./*from w w w . j a v a2 s .com*/ */ private void initializeResultListener() { MessageListenerAdapter adapter = new MessageListenerAdapter(this); adapter.setDefaultListenerMethod("onResult"); container = new DefaultMessageListenerContainer(); container.setConnectionFactory(connectionFactory); container.setDestinationName(JMSNamingSupport.getResultQueueName(profile.getJobId())); container.setMessageListener(adapter); container.afterPropertiesSet(); // Clean Up Hook CleanUpSupport.shutdownContainerWhenFinished(profile.getJobId(), container); }