I have jms queue implementation with jmstemplate. I want to have more than one listener when a message comes in queue. i.e. i want to use topic instead of queue.
i have configuration without jms namespacing. What are the changes need to be made to have multiple listeners listen on a topic when someone send message in topic.
Any help will be appreciated like code example or link.
Best How To :
I guess you are probably using
DefaultMessageListenerContainer. Just to be sure, you want that several individual components receive the same message (i.e. you don't want to process messages in parallel).
Assuming I got this right and component A and compoent B should receive the same message, you simply create two
DefaultMessageListenerContainer instance on the same topic and you set the
pubSubDomain property to
true. Make sure you haven't set any concurrency on the listener container, or better yet, set the concurrency to 1 to make that explicit.
This would give something like
<property name="pubSubDomain" value="true"/>
<property name="concurrency" value="1"/>
<property name="destinationName=" value="...."/> <!-- topic name -->
<property name="messageListener" ref="...."/>
Then you should create a similar bean for the second component.