Announcement Announcement Module
No announcement yet.
jms-listener vs jms-source Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • jms-listener vs jms-source

    I need to be listening to a queue and I see that I can use either jms-source or jms-listener to do the same. Which should I be using ?
    What does jms-source offers above jms-listener and vice-versa ?

    Also, I noticed that when I used jms-source to read the messages from the queue, the queue still retained the message (did not flush).
    While in jms-listener the queue empties as the message is read/processed . Is there any particular implementation detail that Im missing here ?
    Last edited by diippi; Feb 13th, 2008, 12:39 PM. Reason: Addendum

  • #2
    The <jms-source> element can create one of two types of source adapters: JmsPollingSourceAdapter (if the 'poll-period' is provided) or JmsMessageDrivenSourceAdapter (if the 'poll-period' is not provided). The latter will create and delegate to an instance of DefaultMessageListenerContainer. In that sense, it is essentially the same behavior as a directly configured <jms-listener>. The key difference of course is that the Spring Integration source adapters will convert the JMS Message to a generic Message and send it to a MessageChannel. The behavior that you are seeing with the JMS Message on the queue is due to the fact that the JmsMessageDrivenSourceAdapter sets 'sessionTransacted' to TRUE on the underlying DefaultMessageListenerContainer. The normal default value is FALSE.