Can an MDB change the value of a message such as "retryNumber" for it to be picked up again by the selector?
No, but JMSJCA does allow you to maintain a state on a message, especially if that message will be rolled back. For this you can set a user property on the message, and the next time this message is redelivered you can read this value back from the message. The values are kept in memory, so they won't survive a system restart.
All this is within a business process context and not any kind of infrastructure problem whereby
JMSJCA supports global interceptors so that you could potentially factor out this infrastructure logic.
These facilities were built to support a customer who had similar requirements as you in terms of an error handling system and retries. Your requirements appear to be not that much different.
[Message sent by forum member 'fkieviet' (fran...@sun.com)]