Announcement Announcement Module
No announcement yet.
Pool of MDPs If Possible Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pool of MDPs If Possible

    I have a scenario where a lot of complex business logic is executed including the database updates and inserts done from the listener method of the MDB that I have registered in my Spring Configuration file.
    At peak I am expecting a lot of messages arriving to the Queue that my MDP will be listening to - so holding them to have one of processings to get completed is not a good idea I thought.
    My question is - Is there a way I can create a pooled MDPs so that each time a message comes it's listened (and do the complex business logic processing) by a different instance of MDP and so it kind of speeds up the process.
    I also would like to know if it's possible, what are the possible points that can lead to a trouble.

  • #2
    Yes, when using the DefaultMessageListenerContainer, you can provide a value for "concurrentConsumers" to effectively setup a pool of listener processes/threads.


    • #3
      Thanks Mark

      Mark thanks very much for this quick response. I definitely am using the combination of DefaultMessageListenerContainer and org.springframework.jms.connection.JmsTransactionM anager for the sake of listening and transaction management in this whole set of affairs. I will use this attribute to achieve what I wished to do.
      Thanks again.


      • #4
        I had that concurrentConsumers attribute set to 5 and things worked fine. But just to make sure If I am now spawning those 5 number of listener instances I wrote the default constructor in my Listener class and printed the "this" object. It surprisingly gets printed only twice and not 5 times. What can be the primary reason for it.How do I make sure programattically that I raelly have those paralell number of listeners running to grab the mesages from Queue.
        Thanks and appreciate all the answers,


        • #5
          Just throwing an idea. Increase the number of messages. may be then spring container will instantiate 5 MDPs.

          I have a question also. How to load the spring config for this kind of MDPs driven application.(Non-web app). We do not have web.xml.