ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Question about the MQMD MessageID Property

Post new topic  Reply to topic
 Question about the MQMD MessageID Property « View previous topic :: View next topic » 
Author Message
wfudeac92
PostPosted: Wed May 10, 2006 10:17 am    Post subject: Question about the MQMD MessageID Property Reply with quote

Novice

Joined: 24 Apr 2006
Posts: 21

I am looking through some MQ code that I inherited and I have a question about the MessageID property on the MQMD. For some reason, the application generates its own 24 character Message ID and sets the MessageID property on the MQMD to that value before doing the MQPUT. After the MQPUT, we take the MessageID from the MQMD and use that message id to do a get. I have looked through a lot of sample code from IBM and they never generate a MessageID, they just use the Message ID that is returned from the MQPUT to do the MQGET.

Why do you want to generate your own MessageId's? If you do generate your own MessageID, does MQ generate another MessageID after the MQPUT or does it just pass you back the MessageID that you generated? Does it matter whether or not you are using a Datagram when doing the MQPUT? Here is a snippet of the code that I am talking about.

// MQPUT
mqMessage.MessageId = AsciiToEbcdicArray(messageID);
mqQueue.Put(mqMessage, mqPMO);
messageIDPut = mqMessage.MessageId;

.........

// MQGET
MQGetMessageOptions mqGMO = new MQGetMessageOptions();
MQMessage mqMessageReply = new MQMessage();
mqMessageReply.MessageId = messageIDPut;
mqGMO.MatchOptions = MQC.MQMO_MATCH_MSG_ID;
mqGMO.Options = MQC.MQGMO_WAIT | MQC.MQGMO_NO_SYNCPOINT;
mqQueueReply.Get(mqMessageReply, mqGMO);
replyMessage += mqMessageReply.ReadString(mqMessageReply.DataLength);
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 10, 2006 10:20 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

MQPMO_NEW_MESSAGE_ID controls whether or not the MQ Put generates a new message id.

It is always better to allow MQ to generate the message id, but that doesn't stop developers from building in weird dependancies on custom data in the message id.

So if you've inherited both ends of the process, then you can change the requester app and the server app to use an MQ generated id. Otherwise, you should not change this unless you verify with the server app that it will be okay.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wfudeac92
PostPosted: Wed May 10, 2006 10:32 am    Post subject: Reply with quote

Novice

Joined: 24 Apr 2006
Posts: 21

Here are the only MQPMO options that I am using.

MQC.MQPMO_NO_SYNCPOINT | MQC.MQPMO_SET_IDENTITY_CONTEXT;

Is it safe to say that if the MessageID field is always set by the developer, then a new MessageID is not generated by MQ?
Back to top
View user's profile Send private message
wfudeac92
PostPosted: Wed May 10, 2006 10:34 am    Post subject: Reply with quote

Novice

Joined: 24 Apr 2006
Posts: 21

Here are the only MQPMO options that I am using.

MQC.MQPMO_NO_SYNCPOINT | MQC.MQPMO_SET_IDENTITY_CONTEXT;

Is it safe to say that if the MessageID field is always set by the developer, then a new MessageID is not generated by MQ?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 10, 2006 10:40 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

wfudeac92 wrote:
Is it safe to say that if the MessageID field is always set by the developer, then a new MessageID is not generated by MQ?


Does that fit with the what the documentation on MQPMO_NEW_MSG_ID says?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wfudeac92
PostPosted: Wed May 10, 2006 11:19 am    Post subject: Reply with quote

Novice

Joined: 24 Apr 2006
Posts: 21

Here is what I found out. If you specify your own MsgID the queue manager will not overwrite that value. If you do now specify a value the following occurs to generate the MsgId.

A MsgId generated by the queue manager consists of a 4-byte product identifier (AMQ or CSQ in either ASCII or EBCDIC, where 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 on the system clock not being changed backward. To eliminate the possibility of a message identifier generated by the queue manager duplicating one generated by the application, the application must avoid generating identifiers with initial characters in the range A through I in ASCII or EBCDIC (X'41' through X'49' and X'C1' through X'C9'). However, the application is not prevented from generating identifiers with initial characters in these ranges.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 10, 2006 11:36 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzak.doc/js01791.htm wrote:
MQPMO_NEW_MSG_ID
The queue manager replaces the contents of the MsgId field in MQMD with a new message identifier. This message identifier is sent with the message, and returned to the application on output from the MQPUT or MQPUT1 call.

This option can also be specified when the message is being put to a distribution list; see the description of the MsgId field in the MQPMR structure for details.

Using this option relieves the application of the need to reset the MsgId field to MQMI_NONE prior to each MQPUT or MQPUT1 call.

This option is supported on all WebSphere MQ V6.0 systems.


So if you specify your own MsgID, AND specify MQPMO_NEW_MSG_ID, then your ID will not be used.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wfudeac92
PostPosted: Wed May 10, 2006 12:00 pm    Post subject: Reply with quote

Novice

Joined: 24 Apr 2006
Posts: 21

That appears to be the case. Thanks for pointing me in the right direction.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Question about the MQMD MessageID Property
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.