In my current project I am using JBoss 7.1.1 + bundled HornetQ. I am working with a regular JMS Queue and MDB which is exposed as a web service. WebService call produces a message.
Based on the logic, consumer can proceed successfully or throw different named exceptions, which will always 'mark' the message as undelivered.
Now the use case is to react on specific exceptions in a different way.
Let say that if Exception A is thrown, message should be immediately moved to DLQ
If exception B is thrown, message should follow redelivery strategy defined in standard configuration.
So far I did not found any out of the box solution. Is there any way to achieve such "conditional redelivery" based on exception type?
This is really a job for your application, we know nothing on the server about what exceptions are handled by the app server.
I would suggest rather than throwing an exception (which a well behaved MDB shouldnt) you should do something else.