If an application uses putMessage(), specifying that a confirmputMessage() should not be used to confirm this message, the WebSphere MQ-bridge does not use assured delivery logic to pass the message to WebSphere MQ. It does a simple MQPut to the target WebSphere MQ queue. If there is a failure anywhere along the message route, the application is unable to determine whether the message has been sent or not. If the application decides to resend the message, it is possible for two identical messages to arrive on the WebSphere MQ queue.
To avoid this problem, the application programmer should use a combination of putMessage() and confirmputMessage() calls. Using putMessage() with the confirm parameter set to true causes the WebSphere MQ-bridge to use assured delivery logic to put the message to the WebSphere MQ system.
If any component of the path between the WebSphere MQ system and the sending application fails, the application is unable to determine whether the message got to its destination or not. In this case, the application should put the original message again, with a boolean MQeField added. For example:
C example
This indicates that this message has been sent in the past. The WebSphere MQ-bridge uses its assured delivery logic to assure that only one of the two putMessage() calls actually put a message to WebSphere MQ.
If the putMessage() is used, with or without the confirm flag set, and a successful return code is received, the application can be sure that the message has been passed to the WebSphere MQ queue.
If the putMessage() is used, with the confirm flag set, the WebSphere MQ-bridge retains some information about the message (on its sync queue) that enables it to prevent duplicate messages being sent by the application. The WebSphere MQ-bridge can only prevent duplicate messages being sent if the Qos_Retry parameter is set. The confirmputMessage() removes the message history from the WebSphere MQ-bridge sync queue.
The following procedure causes four messages to arrive on the target
WebSphere MQ queue.
| create a new message | |
(1) | putMessage(Confirm=Yes) | - Causes the message to be delivered to WebSphere MQ, but some note made on the sync queue. |
| set the retry bit on the message | |
| putMessage(Confirm=Yes) | - Suppressed, as the message is already noted in the sync queue. |
| putMessage(Confirm=Yes) | - Suppressed, as the message is already noted in the sync queue. |
(2) | putMessage(Confirm=No) | - not suppressed. The message is delivered to the WebSphere MQ queue. |
| remove the retry bit from the message | |
(3) | putMessage(Confirm=Yes) | - Causes the message to be sent to WebSphere MQ. The retry bit was not set, so the WebSphere MQ-bridge did not look at its sync queue. |
| ConfirmputMessage() | - Causes the WebSphere MQ-bridge to clear its memory of the message. |
| set the retry bit on the message | |
(4) | putMessage() | - Causes the message to be sent. |