Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to limit the number of MDB instances listening to a Jboss JMS queue
    text
    copied!<p>I'm having a problem with the following setup:</p> <p>A Java application send email msg to a JMS queue, then an MDB listening to the queue get the email msg with the onMessage method, it open a connection on the Gmail SMTP, send the email to the SMTP and close the connection. Doing this on all message in the JMS queue.</p> <p>It is working great when I have up to 5 messages in the queue at the same time. All messages are picked-up in the same time by 5 different instances of the MDB, so I have 5 concurrent connection to the Gmail SMTP server. But when there is more messages in the JMS queue, I get a connection error from the Gmail SMTP server. The 5 first messages are sent correctly, but not the rest of the bunch, so the other messages are lost because they are not in the queue anymore.</p> <p>So my question is, is it possible to limit the number of MDB instance that will listen to the JMS queue? If I have a maximum of 5 MDB, then even if I have 1000 messages in the queue, it will just take longer to empty the queue, but at least I wont lose any message.</p> <p>Any other suggestion to resolve this issue would be very much appreciated.</p> <p>Here is the Jboss version:</p> <blockquote> <p>[Server] Release ID: JBoss [Trinity] 4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)</p> </blockquote> <p>and the config of the MDB is as following : </p> <pre><code>@MessageDriven(activationConfig = { @ActivationConfigProperty( propertyName = "destinationType", propertyValue = "javax.jms.Queue" ), @ActivationConfigProperty( propertyName = "destination", propertyValue = "queue/emailQueue") }) </code></pre> <p>Do you need more?</p> <p>Thanks</p> <p>EDIT 2011-02-14<br> Maybe I'm all wrong wanting to limit the number of MDB instance. I saw a config about the number of JMS threads. If I limit the number of thread that will post to the MDB, maybe it will resolve my issue? Will the JMS wait until a MDB is available before posting msg again? Is there any side effect to do that? Your though please. Thanks<br> END EDIT</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload