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 » Retrieving Messages

Post new topic  Reply to topic
 Retrieving Messages « View previous topic :: View next topic » 
Author Message
vandana
PostPosted: Tue Jan 29, 2002 6:49 am    Post subject: Reply with quote

Acolyte

Joined: 01 Dec 2001
Posts: 74

Hi,
I'm facing some problems in correlation my messageid with correlationid.
I have 2 Queues ind7_local1 and ind7_reply1.

The program MQReq put a message in ind7_local1
with pmo as new-msg-id and new-correl-id.

The triggering for ind7_local1 is set to on
for every message
such that when a message
arrives on it ,it triggers off another pgm MQRep.
the pgm reads gets message from ind7_local1
with a wait interval of a minute.
(No message id and correl id are specified here)

Now the same pgm puts the message in ind7_reply1
with options

put_msg.correlationId=get_msg.messageId.

The MQReq is suppossed to pick up this message
and the options set in this program
for geting message are
get_msg.correlationId=put_msg.messageId.
Everything works fine when the ind7_local1 is initially empty ...
How does the flow exactly take place in this case ?
When i put in the message in ind7_local1 i see a messageid and corr id value.
HowEver when the message is read by MQRep a diff messageid and correlationid
is generated ...
What is the use of copying msgid to corrid in both the programs ???
What is the relationship between messageid and correlationid ????


Thanks and Regards,
Vandana






Back to top
View user's profile Send private message
bduncan
PostPosted: Thu Jan 31, 2002 6:39 pm    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

I will start with your last question first, since it is probably the easiest to answer
"What is the relationship between messageid and correlationid ???? "
-- There is no inherent relationship. In fact, the queue manager will only generate messageids for you, it cannot do the same for correlid. It is up to you, the application designer to create a relationship between the two. While MQSeries manuals suggest that the messageid uniquely identifies each message, this is not forced upon you. In fact, if you so choose, you can make the correlid uniquely identify your messages and not use the messageid field at all. Or, if your conventions require a unique identifier that is longer than the 48 byte messageid field, you can actually spread the value across both the messageid and correlid field. The two would act together to uniquely identify the message, much like multiple columns can act as a primary key in a database.

"What is the use of copying msgid to corrid in both the programs ??? "
-- Again, the usefulness of this exercise is up to you. If you don't use the correlid in your system, there is no need to copy it. If you aren't trying to correlate messages at all (fire and forget scheme) then there is no need to keep track of the messageid, etc... Typically, in an MQSeries system where you have a requestor expecting a reply, your messages look like the following:

Request Message
---------------
MsgId 1111111111
CorrelId [null]

While this message is created, the requestor application will store the messageid that was generated by the queue manager (or if you are setting the messageid manually, you probably already have it stored in a variable). When this message is sent off, the receiver gets it, processes the data, and prepares a reply message. It looks like this:

Reply Message
-----------------
MsgId 2222222222
CorrelId 1111111111

This reply message is sent, and meanwhile, the requestor application has been doing an MQGET on the reply queue, waiting for the reply. The MQGET has been specified to match against CorrelId, specifically a correlid of 1111111111 which equals the messageid of the original request message. Notice that the messageid of the reply message is irrelevant. The requestor application doesn't care what it is, because it is only matching against the correlid of the reply message.

Now I have a question for you, when you say "The triggering for ind7_local1 is set to on for every message such that when a message arrives on it ,it triggers off another pgm MQRep. the pgm reads gets message from ind7_local1 with a wait interval of a minute."
What worries me is that you are triggering on type every. Depending on the structure of your application, this could cause problems for you. Since your application is already MQGETing until there are no new messages for 1 minute, there is no point in spawning others off (unless of course, you specifically need this functionality for some reason I'm not aware of) So you should probably set the trigger type to first, and give your application a sufficient enough wait time so that it isn't continuously triggering (one minute should be fine, but again, the specifics of your system may warrant some other value).


_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
StefanSievert
PostPosted: Thu Jan 31, 2002 8:23 pm    Post subject: Reply with quote

Partisan

Joined: 28 Oct 2001
Posts: 333
Location: San Francisco

Quote:

On 2002-01-31 18:39, bduncan wrote:
I will start with your last question first, since it is probably the easiest to answer
"What is the relationship between messageid and correlationid ???? "
-- There is no inherent relationship. In fact, the queue manager will only generate messageids for you, it cannot do the same for correlid.


I hate to rain on such a wonderful parade, but that's not quite correct. You can certainly ask the queue manager to generate a new correlid by specifying MQPMO_NEW_CORREL_ID in you put messages option.
Other than that, have you ever thought about writing manuals or books, Brandon?
Have a great weekend everybody,
Stefan

_________________
Stefan Sievert
IBM Certified * WebSphere MQ
Back to top
View user's profile Send private message
bduncan
PostPosted: Mon May 06, 2002 2:41 pm    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

In most APIs, the MQMD datastructure you passed into the MQPUT will be populated with the MessageId generated by the queue manager. For instance, in Perl, after I do the MQPUT where I specified MQPMO_NEW_MESSAGE_ID and left the $MQMD{MsgId} parameter empty, the queue manager will automatically generate a new message id, and place that in the MQMD structure. So if I look at $MQMD{MsgId} after the MQPUT, it will equal the message id of the message that was just put to the queue.

Stefan,
I noticed your previous response (which I seemed to have missed) and yes, you are correct about the generation of correlation ids. I'm wondering if the queue manager makes a best effort in trying to ensure the auto-generated correlids are unique, in the same way it does with messageids... As far as writing, I was actually an English major in college for a short time, before I realized I'd be dirt poor for the rest of my life (just kidding!) Actually, it was a choice between something I enjoyed and could make money doing (computers) versus something I enjoyed and would make a lot less money doing - assuming I'm not the next Tom Clancy in waiting That reminds me of a quote by Muhammad Ali: "I am the greatest golfer in the world. I just haven't played yet."


_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Retrieving Messages
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.