Tuesday, June 03, 2008

How to resolve MQ Channel Sequence Mismatch Error (AMQ9526)

This error would like occur when the local and remote queue managers do not agree on the next message sequence number. For example, when channels goes down or restarted due to network or other issues.

You will see the following error in the Queue manager error log.

AMQ9526 Message sequence number error for channel

So, how to correct this problem??

1) Do a display channel status
DIS CHS(XXXXXXX)
for the sender channel

2. If the channel is still running,
STOP CHANNEL(XXXXXXX) MODE(FORCE).

This will stop transmission of the current batch and will likely result in message being in-doubt.

From my experience so far, i would only issue

stop chl(XXX)

I have not encountered the need to use FORCE yet. Maybe use FORCE when you cant stop the channel the first time round.

3. Lets clear up any in-doubt messages

RESOLVE CHANNEL (XXXXXXX) ACTION(BACKOUT).

This requests channels to commit or back out in-doubt messages. This command can be used only for sender (SDR), server (SVR), and cluster-sender (CLUSSDR) channels (including those that have been defined automatically). The messages are backed out, that is, they are restored to the transmission queue.

So far, i have no need to do step 3.

** IMPORTANT **
From researching the internet, in 99.9% of cases you never use the facility and it's actually dangerous to do so. In-doubt channel problems are usually resolved automatically.

Under certain unusual conditions, the channel can't resolve the situation itself. For this situtation the resolve channel command has been provided so the MQ administrator, using facilities unavailable to the MCAs, can determine what to do to resolve the channel and instruct the system accordingly.

** IMPORTANT **

Do not use RESOLVE CHANNEL (XXXXXXX) ACTION(COMMIT) without considering that the messages are committed, that is, they are deleted from the transmission queue


4. Reset the sequence number

RESET CHANNEL(XXXXXXXX) SEQNUM(1).

This resets the message sequence number for a MQ channel with an optionally specified sequence number to be used the next time the channel is started.

As the sequence number is set by the sender channel so there is no need to reset the receiver.

The sequence number of the last committed message or LUWID is recorded at the receiving end. This is used not only at the sending end but also during re-sequencing, on startup and restarts to ensure that both ends of the link agree on which message have been sent.


5. ALmost there. Start up the channel.

START CHANNEL(XXXXXXX)

6. Done.

Additional information:

Each persistent message that is sent using message sequencing is tagged with an individual sequence number. These are incremented by 1 for each message sent, first on the sending end then on the receiving end. These numbers must match for sequential delivery to work correctly. So, if a message is sent with sequence number of 412 then the receiver side needs to be looking for message number 412.


more references from my favourite places -