What do you want to happen with the JMS message when the bean can not process it? Should it
- rollback (put back on queue)
For rollback you need to use transacted JMS, and then it should happend automatically if your bean just throws an exception if it can not process the message.
However if you want the JMS message to commit then you need to deal what should happen.
How does you bean determine it can not process the message?
- thrown an exception
- or some other condition? like a method that returns a boolean?
What should happen with the message if #2 can not process the message? Should it just be forgotten? Or routed to another JMS queue or other store?
Are you looking for to pause/start the JMS consumer depending on some conditions? If so then it requires a bit manual Java code to start and stop consumers on-the-fly.