I had a MDB that falled into an error on a external resource (a connection on another JMS). This resource is a QueueConnection initialized in create method. Every messages coming after on this MDB falled in error, but the corrupted Message Driven Bean were active in the pool. I need to drop this MDB in case of error.
If I throw an exception the current message is not ack, but the Bean is still live.
I could invoke clear() on MDB pool, but I prefer to clear only the corrupted MDB.
Can I call destroy() directly from onMessage() method in case of error?