I really need help on how to solve this problem! How do I get the expected behavior? Can it be done? Is it a bug?
Short problem description:
After restarting JBoss, pending messages on a durable topic will be put on DLQ. This is NOT what I expect. I want them to stay on the topic even after a restart.
Background to my problem:
I have a topic and two durable subscribers (two MDB's). One of the subscribers will try to deliver messages to a web service, which _can_ be offline. In that case, the MDB will throw an exception, causing a rollback, and the message will be redelivered later. This works just fine.
The problem is that when there is pending messages, which is the case when the web service is offline, and I restart JBoss, all pending messages on the topic will be put on DLQ.
By default, the MDB will run 16 sessions in parallell, and these will stay "durable" even after a restart.
- I publish 56 messages to the topic
- The web service is offline
- Subscriber 1 (the "web service" one) now has 56 pending messages
- Subscriber 2: 56 successfully processed messages, 0 pending messages
- DLQ: 0 pending messages
Result after the restart:
- Subscriber 1 (the "web service" one) now has 16 pending messages
- Subscriber 2: 0 pending messages
- DLQ: 40 pending messages
- JBoss 4.2.3
- JBoss Messaging 1.4.4 (have also tried with 1.4.2 with the same result)
- Using a MSSQL database for persistance
The problem has been solved. The reason is that "DefaultMaxDeliveryAttempts" was set to -1 in messaging-service.xml. I set it to 151200, so now it works fine!