Author |
Message
|
MVO |
Posted: Mon Feb 09, 2004 6:59 am Post subject: MQ MsgId |
|
|
 Centurion
Joined: 09 Sep 2001 Posts: 131
|
Hi,
Can you tell me what uniquely identifies a message in a queue of a queue manager ? because I can put 2 messages with the same MsgId to a queue without any problem - at least on a non-mainframe platform such as Windows, Unix.
If we allow duplicate MsgIds, does it mean recovery will not be possible ?
Thanks |
|
Back to top |
|
 |
vennela |
Posted: Mon Feb 09, 2004 7:16 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
This is from the Application Reference manual
Quote: |
Generally, no two messages should have the same message identifier, although this is not disallowed by the queue manager. |
But if you want you can allow the Queue Manager to generate a unique message id for you. |
|
Back to top |
|
 |
kman |
Posted: Tue Feb 17, 2004 12:59 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2003 Posts: 309 Location: Kuala Lumpur, Malaysia
|
If you set your own message ID, the queue manager would still send the message. It is not a restriction. But if you let the queue manager create and set the msg ID, this will always be unique.
Reason for uniqueness is because
Quote: |
A MsgId generated by the queue manager consists of a 4-byte product identifier (‘AMQb’ or ‘CSQb’ in either ASCII or EBCDIC, where ‘b’ represents a blank), followed by a product-specific implementation of a unique string. In WebSphere MQ this contains the first 12 characters of the queue-manager name, and a value derived from the system clock. All queue managers that can intercommunicate must therefore have names that differ in the first 12 characters, in order to ensure that message identifiers are unique. The ability to generate a unique string also depends upon the system clock not being changed backward. |
|
|
Back to top |
|
 |
MVO |
Posted: Tue Feb 17, 2004 6:10 am Post subject: |
|
|
 Centurion
Joined: 09 Sep 2001 Posts: 131
|
Thanks for all your replies. They still don't answer my question. If 2 messages in the same queue on the same queue manager have the same MsgId, does it mean they cannot be recovered in case of MQ failure that requires recovery from MQ logs ? |
|
Back to top |
|
 |
bob_buxton |
Posted: Tue Feb 17, 2004 6:10 am Post subject: |
|
|
 Master
Joined: 23 Aug 2001 Posts: 266 Location: England
|
The queue manager does not rely on the message id (or correlid) being unique for recovery purposes. It has its own mechanisms for identifying messages to be restored from the logs on restart.
Some applications may require unique message ids in order to work correctly, for example, if they also use message id as a database key. _________________ Bob Buxton
Ex-Websphere MQ Development |
|
Back to top |
|
 |
bduncan |
Posted: Tue Feb 17, 2004 12:36 pm Post subject: |
|
|
Padawan
Joined: 11 Apr 2001 Posts: 1554 Location: Silicon Valley
|
Bob is right.
There is nothing inherently wrong with having multiple messages on the same queue with the same MsgId - but why would you want to ever do that?  _________________ Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator |
|
Back to top |
|
 |
manojt |
Posted: Tue Feb 24, 2004 5:05 am Post subject: |
|
|
Newbie
Joined: 26 Sep 2003 Posts: 9
|
Yes two msg can have same msg ID. Question how Q Manager recovers is i think it uses timestamp to identify the unique msg because u know no 2 msg can have same time stamp. correct me if i m wrong.
Manoj |
|
Back to top |
|
 |
kman |
Posted: Tue Feb 24, 2004 5:13 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2003 Posts: 309 Location: Kuala Lumpur, Malaysia
|
Manoj,
you are not entirely right in that sense. A time stamp can still be duplicate. That's why for unique msgid, MQ have added a few more fields to it. See my previous posting on this. |
|
Back to top |
|
 |
Missam |
Posted: Tue Feb 24, 2004 3:35 pm Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
queue manager uses checkpoint while recovering from a failure not msgids and timestamps.if you have more questions about recovery ,you can go through System Adminstration .Restart and recovey.this explains much in detail |
|
Back to top |
|
 |
|