/** * Set the {@link MessageHandlerMethodFactory} to use to configure the message * listener responsible to serve an endpoint detected by this processor. * <p>By default, {@link DefaultMessageHandlerMethodFactory} is used and it * can be configured further to support additional method arguments * or to customize conversion and validation support. See * {@link DefaultMessageHandlerMethodFactory} Javadoc for more details. */ public void setMessageHandlerMethodFactory(MessageHandlerMethodFactory messageHandlerMethodFactory) { this.messageHandlerMethodFactory.setMessageHandlerMethodFactory(messageHandlerMethodFactory); }
private MessageHandlerMethodFactory getMessageHandlerMethodFactory() { if (this.messageHandlerMethodFactory == null) { this.messageHandlerMethodFactory = createDefaultJmsHandlerMethodFactory(); } return this.messageHandlerMethodFactory; }
@JmsListener(id = "first", destination = "myQueue") @JmsListener(id = "second", destination = "anotherQueue", concurrency = "2-10") public void repeatableHandle(String msg) { } }
@JmsListeners({ @JmsListener(id = "first", destination = "myQueue"), @JmsListener(id = "second", destination = "anotherQueue", concurrency = "2-10") }) public void repeatableHandle(String msg) { } }
@Configuration @EnableJms static class EnableJmsDefaultContainerFactoryConfig { @Bean public JmsListenerContainerTestFactory jmsListenerContainerFactory() { return new JmsListenerContainerTestFactory(); } }
@Bean public JmsListenerAnnotationBeanPostProcessor postProcessor() { JmsListenerAnnotationBeanPostProcessor postProcessor = new JmsListenerAnnotationBeanPostProcessor(); postProcessor.setContainerFactoryBeanName("testFactory"); postProcessor.setEndpointRegistry(jmsListenerEndpointRegistry()); return postProcessor; }
@OrderQueueListener(id = "first") @BillingQueueListener(id = "second", concurrency = "2-10") public void repeatableHandle(String msg) { } }
@FooListener public void handleIt(String body) { } }
@Override public void fullConfigurableConfiguration() { ConfigurableApplicationContext context = new AnnotationConfigApplicationContext( EnableJmsFullConfigurableConfig.class, FullConfigurableBean.class); testFullConfiguration(context); }
@JmsListener(containerFactory = "simpleFactory", destination = "myQueue") public void simpleHandle(String msg) { } }
@EnableJms @Configuration static class EnableJmsSampleConfig { @Bean public JmsListenerContainerTestFactory jmsListenerContainerFactory() { return new JmsListenerContainerTestFactory(); } @Bean public JmsListenerContainerTestFactory simpleFactory() { return new JmsListenerContainerTestFactory(); } }
@JmsListener(destination = "myQueue") public void handleIt(String msg) { } }
@EnableJms @Configuration static class EnableJmsFullConfig { @Bean public JmsListenerContainerTestFactory simpleFactory() { return new JmsListenerContainerTestFactory(); } }
@JmsListener(destination = "testQueue") public void handleIt(String body) { } }
@JmsListener(destination = "myQueue") public void handle(String msg) { } }
@JmsListener(id = "listenerId", containerFactory = "customFactory", destination = "myQueue") public void customHandle(String msg) { } }
@JmsListener(destination = "myQueue") public void defaultHandle(String msg) { }
@JmsListener(id = "listener1", containerFactory = "simpleFactory", destination = "queueIn", selector = "mySelector", subscription = "mySubscription", concurrency = "1-10") @SendTo("queueOut") public String fullHandle(String msg) { return "reply"; } }
@JmsListener(id = "${jms.listener.id}", containerFactory = "${jms.listener.containerFactory}", destination = "${jms.listener.destination}", selector = "${jms.listener.selector}", subscription = "${jms.listener.subscription}", concurrency = "${jms.listener.concurrency}") @SendTo("${jms.listener.sendTo}") public String fullHandle(String msg) { return "reply"; } }