Results 1 to 5 of 5

Thread: Pool of MDPs If Possible

  1. #1

    Default Pool of MDPs If Possible

    Hi,
    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.
    Thanks,
    Sharad

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

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

  3. #3

    Default 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. #4

    Default

    Hi,
    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,
    Sharad

  5. #5
    Join Date
    Jul 2011
    Posts
    1

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •