Back Forum Reply New

multiple listeners for a destination

mand.ActiveMQQueuequot;gt;       lt;constructor-arg value=quot;orderPaidQueuequot;/gt;   lt;/beangt;
lt;!-- order CDs --gt;
lt;bean id=quot;orderCDListenerquot; class=quot;org..jms.listener.adapter.Me  ssageListenerAdapterquot;gt;       lt;property name=quot;delegatequot; ref=quot;cdProcessorServicequot;/gt;       lt;property name=quot;defaultListenerMethodquot; value=quot;orderCDquot;/gt;       lt;property name=quot;defaultResponseDestinationquot; ref=quot;replyQueuequot;/gt;   lt;/beangt;     lt;bean id=quot;orderCDContainerquot; class=quot;org..jms.listener.SimpleMess  ageListenerContainerquot;gt;       lt;property name=quot;connectionFactoryquot; ref=quot;connectionFactoryquot;/gt;       lt;property name=quot;messageListenerquot; ref=quot;orderCDListenerquot;/gt;       lt;property name=quot;destinationquot; ref=quot;orderPaidQueuequot;/gt;   lt;/beangt;lt;!-- listen for paid orders, and send confirmation email --gt;
lt;bean id=quot;sendEmailConfirmationListenerquot; class=quot;org..jms.listener.adapter.Me  ssageListenerAdapterquot;gt;       lt;property name=quot;delegatequot; ref=quot;OrderProcessorquot;/gt;       lt;property name=quot;defaultListenerMethodquot; value=quot;sendConfirmationEmailquot;/gt;       lt;property name=quot;defaultResponseDestinationquot; ref=quot;replyQueuequot;/gt;   lt;/beangt;

lt;bean id=quot;sendEmailContainerquot; class=quot;org..jms.listener.SimpleMess  ageListenerContainerquot;gt;       lt;property name=quot;connectionFactoryquot; ref=quot;connectionFactoryquot;/gt;       lt;property name=quot;messageListenerquot; ref=quot;sendEmailConfirmationListenerquot;/gt;       lt;property name=quot;destinationquot; ref=quot;orderPaidQueuequot;/gt;   lt;/beangt;

Queues are one message, one consumer. Topics are one message, multiple consumers.

Having a pool of queue listeners on the receiving side is for high availability and load balancing, so that if one goes down, there is a backup. But still only one message gets consumed.

Switch to topics and the message is held onto until all active listeners get a copy.
¥
Back Forum Reply New