Originally posted by Chetan M:
Sergui, am not throwing any exception instead, loging msg to file n console in the case as shown below.
That is your problem... since you are not throwing a system exception and you are not explicitly rolling back the transaction then the message is essentially being discarded.
Originally posted by Chetan M:
If inside onMessage() i throw an exception, are you sure that message is put back into the queue? and any specific exception to be thrown?
Yes, the container is required to place the message back on the Queue if your transaction is marked for rollback. An
EJB Container will only automatically mark a transaction to rollback if you throw a system exception (pretty much anything extending from RuntimeException).
FYI, this may not solve your problem completely because the message will just get put back on the Queue and immediately consumed again. Most JMS Providers allow a configurable delay time before the message is resent to deal with these types of situations. Check your JMS Provider's documentation for more details.