Announcement Announcement Module
No announcement yet.
Configuring multiple queue Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuring multiple queue


    I want to listen asyncronously listen to queue.
    One way of doing is with Message Driven Bean,other would be by a Message Driven POJO,where I would have to write a web application for it.
    Are there any other ways in Spring to implement the above scenario.
    Also if i go for Message Driven POJO ,I need to configure a Message Driven POJO such that the it can listen to multiple queues.
    What configuration should I put in the applicationContext.xml

  • #2
    You do not need a web application for a Message-driven POJO. Any Spring application can support that. For example, you can have a main() method that simply creates the ApplicationContext by pointing to a configuration file. If that configuration file includes a Message-driven POJO, then it will start the background process that listens to the Queue.


    • #3
      Regarding your second question... you can listen to multiple queues with the same POJO by providing more than one <listener> sub-element within a <listener-container> (both elements are defined in the 'jms' namespace). Here's a simple example:
          <jms:listener destination="queue1" ref="somePojo" method="someMethod" />
          <jms:listener destination="queue2" ref="somePojo" method="someMethod" />
      For more information, you might want to consult the reference manual: