Example 3: The system experiences problems with a problem message
To prepare for a problem message, configure the system to move that message to an exception destination and allow other messages to be processed successfully.
Before you begin
The destination to which the MDB listens must use an exception destination. This exception destination can be the system default, or one configured specifically for the destination.
- The enterprise application that contains the MDB.
- The dependent external system resources.
- Set a value of 3 for the 循序失敗訊息臨界值. This is the maximum number of sequential failures of delivery of messages, after which the MDB is stopped. This property applies to sets of messages.
- Set a value of 5000 for the 失敗訊息重試的延遲間隔, that is, the time in milliseconds before a failing message is available to be delivered to the MDB. Other messages might be delivered during this period, unless the循序失敗訊息臨界值 and the maximum concurrency is set to 1.
- Set a value of 5 for the 每個訊息的失敗遞送次數上限, that is, the maximum number of failed attempts to process a message, after which the message is forwarded from its intended destination to the exception destination. This property applies to individual messages.
About this task
In this scenario, the enterprise application is a continuously running system that uses a deployed MDB to access an external system resource.
When a problem message (msg1 in this scenario) is encountered, it is put back on the queue.
Instead of msg1 being made available to the MDB immediately, it is hidden for the 失敗訊息重試的延遲間隔 retry delay of five seconds.
The next message on the queue (msg2) is processed by the MDB. This message and subsequent messages succeeds.
When the 失敗訊息重試的延遲間隔 for msg1 expires, msg1 is unhidden and reprocessed. It is put back on the queue again.
The MDB continues to process subsequent messages normally but each time msg1 is processed, it is put back on the queue.
When the number of times msg1 has been unhidden, rolled back and rehidden reaches the 每個訊息的失敗遞送次數上限 limit (five times in this scenario), it is moved to the configured exception destination.