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 » General IBM MQ Support » Need to send MsgId and CorreId to another system

Post new topic  Reply to topic
 Need to send MsgId and CorreId to another system « View previous topic :: View next topic » 
Author Message
Sathiyendran
PostPosted: Fri Jul 17, 2015 2:25 am    Post subject: Need to send MsgId and CorreId to another system Reply with quote

Newbie

Joined: 17 Jul 2015
Posts: 5

Need to send a msg to the another system and also looking for the corresponding response back to the source system

MOVE MQMT-REQUEST TO MQMD-REQUEST-TYPE
MOVE MQMI-NONE TO MQMD-MSD-ID
MOVE MQCI-NONE TO MQMD-CORREID

Anyone suggest and provide an idea to generate unique MsgId and CorreId for the new message to the request MQ and also how to send a reply back to source system with the help of MsgId and CorreId received.
Back to top
View user's profile Send private message
exerk
PostPosted: Fri Jul 17, 2015 3:48 am    Post subject: Re: Need to send MsgId and CorreId to another system Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

Sathiyendran wrote:
Anyone suggest and provide an idea to generate unique MsgId and CorreId for the new message to the request MQ and also how to send a reply back to source system with the help of MsgId and CorreId received.

I believe the convention is to leave MQ to generate a MsgId for your request message, which you then trap, and for the receiving application to extract the MsgId from your message, and plug into the CorrelId field of the reply message. You would then do a get-message-by-CorrelId on the reply-to-queue, using the MQ-generated MsgId you trapped as the index.
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.


Last edited by exerk on Wed Jul 22, 2015 2:32 am; edited 1 time in total
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jul 17, 2015 4:55 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Have you looked at the samples?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Sathiyendran
PostPosted: Fri Jul 17, 2015 9:31 am    Post subject: Need to send MsgId and CorreId to another system Reply with quote

Newbie

Joined: 17 Jul 2015
Posts: 5

Thanks for your replies.

Please clarify the below - We will not known the MsgId/CorreId till MQPUT/MQPUT1 call execute. let we assume that we have written 10 requests and receiving apps send the response for 6 requests only then how do we want to retrieve the response from the reply MQ because we dont have the MsgId/CorreId.

Please correct me if I'm wrong.

Also I saw some example like in Put Message Option we will be able to add MQPMO_NEW_MSG_ID and MQPMO_NEW_CORREL_ID. Again there are numeric values are added in PMO.

Please provide if you have any examples - We need to write some message and need to retrieve the corressponding response from reply MQ
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jul 17, 2015 9:34 am    Post subject: Re: Need to send MsgId and CorreId to another system Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Sathiyendran wrote:
Please clarify the below - We will not known the MsgId/CorreId till MQPUT/MQPUT1 call execute. let we assume that we have written 10 requests and receiving apps send the response for 6 requests only then how do we want to retrieve the response from the reply MQ because we dont have the MsgId/CorreId.

Please correct me if I'm wrong.


You're wrong.

Look at the samples as suggested.

You don't have the MsgId/CorrelId until the MQPut / MQPut1 call executes. Then you do have it.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sathiyendran
PostPosted: Wed Jul 22, 2015 1:26 am    Post subject: Sample Code written Reply with quote

Newbie

Joined: 17 Jul 2015
Posts: 5

This was the code written to send a message to another application.

MOVE WS-QUEUE-ALIAS TO MQOD-OBJECTNAME.
MOVE WS-REPLY-QUEUE-ALIAS TO MQMD-REPLYTOQ
MOVE SPACES TO MQMD-REPLYTOQMGR
MOVE MQMT-REQUEST TO MQMD-MSGTYPE
MOVE MQMI-NONE TO MQMD-MSGID
MOVE MQMI-NONE TO MQMD-CORRELID
MOVE MQPER-PERSISTENT TO MQMD-PERSISTENCE.

COMPUTE MQPMO-OPTIONS = MQPMO-SYNCPOINT
+ MQPMO-NEW-MSG-ID
+ MQPMO-NEW-CORREL-ID
+ MQPMO-FAIL-IF-QUIESCING.

DISPLAY 'NEW MSG ID : ' MQMD-MSGID
DISPLAY 'NEW COR ID : ' MQMD-CORRELID

CALL 'MQPUT1' USING MQ-HCONN,
MQ-OBJ-DESCRIPTOR,
MQ-MSG-DESCRIPTOR,
MQ-PUT-OPTIONS,
MQ-MESSAGE-LENGTH,
MQ-MESSAGE-DATA,
MQ-COMPLETION-CODE,
MQ-REASON.

Please review and update whether the above code will generate MsgId and correlId and sent to another app.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Jul 22, 2015 1:59 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Have you tried the code?
What happens?
Have you browsed the messages before the reciever reads the message AND again before the reply is Read?
Are the MQMD and CORRELID fields in the MQ header as you expect?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Jul 22, 2015 2:09 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Always clear the msgid/correlid fields in the MQMD buffer, between every MQPUT (if doing more than one).

Otherwise they will get re-used and you won't get unique msgids.
_________________
Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jul 22, 2015 4:36 am    Post subject: Re: Sample Code written Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Sathiyendran wrote:
Please review and update whether the above code will generate MsgId and correlId and sent to another app.


Yes it will.

As my worthy associates point out, if you don't have some code before you do the get of the reply, you'll use the wrong ids. Likewise the DISPLAY statements are in the wrong place and are the reason you think you're not generating message ids.

Look at the sample code
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sathiyendran
PostPosted: Thu Jul 23, 2015 12:07 am    Post subject: Reply with quote

Newbie

Joined: 17 Jul 2015
Posts: 5

Thank you for all your replies.

I am not yet tried to read the message. Let me try that and post here whether MQ header have the MsgId and correlId or not.

Also I will make sure to clear those fields before writing new message to the MQ
Back to top
View user's profile Send private message
tczielke
PostPosted: Thu Jul 23, 2015 4:08 am    Post subject: Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 941
Location: Illinois, USA

One note, you don't need to reset the MsgId or CorrelId before each PUT, if you use the MQPMO_NEW_MSG_ID or MQPMO_NEW_CORREL_ID PMO options. This is documented in the MQ manual, and is also explained in the amqsput0.c sample (snippet below);

Code:

   /******************************************************************/
   /* Use these options when connecting to Queue Managers that also  */
   /* support them, see the Application Programming Reference for    */
   /* details.                                                       */
   /* The MQPMO_NEW_MSG_ID option causes the MsgId to be replaced,   */
   /* so that there is no need to reset it before each MQPUT.        */
   /* The MQPMO_NEW_CORREL_ID option causes the CorrelId to be       */
   /* replaced.                                                      */
   /******************************************************************/
   /* pmo.Options |= MQPMO_NEW_MSG_ID;                               */
   /* pmo.Options |= MQPMO_NEW_CORREL_ID;                            */

_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jul 23, 2015 5:01 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Sathiyendran wrote:
Let me try that and post here whether MQ header have the MsgId and correlId or not.


It will.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » General IBM MQ Support » Need to send MsgId and CorreId to another system
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.