When using @JmsListener it uses the @JmsListener , which extends the JmsDestinationAccessor , which defaults to pubSubDomain false . When this property is false, it runs in the queue. If you want to use themes, you must set this property to true .
When you use Spring Boot , you can easily set this property to true by adding the spring.jms.pub-sub-domain property to application.properties and set it to true .
spring.jms.pub-sub-domain=true
When using @JmsListener it searches for a jmsListenerContainerFactory named bean if it is unavailable by default one is expected. You can also enable your own bean and programmatically set this property yo true .
@Bean public DefaultMessageListenerContainer jmsListenerContainerFactory() { DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer(); dmlc.setPubSubDomain(true);
This, of course, will work, but there will be more work, more information on this can be found in the @EnableJms documentation annotation .
M. Deinum
source share