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 Discussion » question on Correlation ID, Low values and MQ Get

Post new topic  Reply to topic
 question on Correlation ID, Low values and MQ Get « View previous topic :: View next topic » 
Author Message
anveshita
PostPosted: Mon Mar 25, 2019 9:29 am    Post subject: question on Correlation ID, Low values and MQ Get Reply with quote

Master

Joined: 27 Sep 2004
Posts: 254
Location: Jambudweepam

I have a question on how low values impact Correlation ID and MQ GET. Here is the scenario.
We are using a MQ request and response pattern. So when source application (Mainframe) sends a message to back end Java application, the request Message ID is being mapped to the response Correlation ID. So you have a one-to-one relation to tie each request and response. The source application waits say 5 sec and if the response does not come back in that interval, the response message stays on the queue.

Now what we are trying to is to process the responses received after the initial timeout of 5 sec using a different batch program on mainframe. What we have observed, is when correlation id is populated with low values and MQ GET is issued to GET message by correlation Id, the application is pulling the first available message on the queue. This is bit confusing. Shouldn't the MQ GET fail if we issue MQ GET by correlation ID( with low values)that did not match the correlation id of the of the message on the queue? Please let me know why the MQ GET is behaving differently. What are we doing wrong? I do not have much knowledge on z/os, not sure what could be going wrong here. From the application program guide I gather if message ID and and Correlation id are set to low values it pulls the first available message. But here only correlation id was set to low values.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Mar 25, 2019 10:26 am    Post subject: Re: question on Correlation ID, Low values and MQ Get Reply with quote

Grand High Poobah

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

anveshita wrote:
I have a question on how low values impact Correlation ID and MQ GET. Here is the scenario.
We are using a MQ request and response pattern. So when source application (Mainframe) sends a message to back end Java application, the request Message ID is being mapped to the response Correlation ID. So you have a one-to-one relation to tie each request and response. The source application waits say 5 sec and if the response does not come back in that interval, the response message stays on the queue.

Now what we are trying to is to process the responses received after the initial timeout of 5 sec using a different batch program on mainframe. What we have observed, is when correlation id is populated with low values and MQ GET is issued to GET message by correlation Id, the application is pulling the first available message on the queue. This is bit confusing. Shouldn't the MQ GET fail if we issue MQ GET by correlation ID( with low values)that did not match the correlation id of the of the message on the queue? Please let me know why the MQ GET is behaving differently. What are we doing wrong? I do not have much knowledge on z/os, not sure what could be going wrong here. From the application program guide I gather if message ID and and Correlation id are set to low values it pulls the first available message. But here only correlation id was set to low values.

Working as designed. Look at the value of the constant MQCI_NONE
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
hughson
PostPosted: Tue Mar 26, 2019 2:06 am    Post subject: Re: question on Correlation ID, Low values and MQ Get Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

anveshita wrote:
Shouldn't the MQ GET fail if we issue MQ GET by correlation ID( with low values)that did not match the correlation id of the of the message on the queue? Please let me know why the MQ GET is behaving differently. What are we doing wrong? I do not have much knowledge on z/os, not sure what could be going wrong here.

There is nothing specific to z/OS here. If the correlation ID field is not provided, it contains all zeroes. With this value it is considered not to be set. You cannot request to only be returned a message with a correlation ID of all zeroes. If you try to, what you are actually requesting is any correlation ID.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
anveshita
PostPosted: Wed Mar 27, 2019 9:34 am    Post subject: Re: question on Correlation ID, Low values and MQ Get Reply with quote

Master

Joined: 27 Sep 2004
Posts: 254
Location: Jambudweepam

hughson wrote:
anveshita wrote:
Shouldn't the MQ GET fail if we issue MQ GET by correlation ID( with low values)that did not match the correlation id of the of the message on the queue? Please let me know why the MQ GET is behaving differently. What are we doing wrong? I do not have much knowledge on z/os, not sure what could be going wrong here.

There is nothing specific to z/OS here. If the correlation ID field is not provided, it contains all zeroes. With this value it is considered not to be set. You cannot request to only be returned a message with a correlation ID of all zeroes. If you try to, what you are actually requesting is any correlation ID.

Cheers,
Morag

Thank you all.
But if we initialize the field with spaces, the MQ GET fails with an error it could not find the requested message. So I was thinking low-values could be the issue.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Mar 27, 2019 10:36 am    Post subject: Re: question on Correlation ID, Low values and MQ Get Reply with quote

Grand High Poobah

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

anveshita wrote:
But if we initialize the field with spaces, the MQ GET fails with an error it could not find the requested message. So I was thinking low-values could be the issue.


If you fill the field with spaces, you're asking the verb to get the message with a correlation id of spaces (spoiler alert - it won't find one unless you've got some seriously bad practice code putting messages). If you fill the field with low values (which are not spaces) you're indicating that you don't care about the value of the correlation id. Even if you've also specified get by correlation id as an option.

This is not an issue. This is how it works.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Mar 27, 2019 11:22 am    Post subject: Re: question on Correlation ID, Low values and MQ Get Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

anveshita wrote:
But if we initialize the field with spaces, the MQ GET fails with an error it could not find the requested message. So I was thinking low-values could be the issue.

More precisely, you did not get an error. Rather, you received a 2033 no message available ReasonCode. That's because you initialized the field with spaces, which are either x'20's (ASCII) or x'40's EBCDIC.

The MQGET call, working as designed and documented, could not find a message with the matching CorrelId. As FJ suggested, MQCI_NONE is the appropriate value for requesting the next available message with "any CorrelId."
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Wed Mar 27, 2019 3:28 pm    Post subject: Re: question on Correlation ID, Low values and MQ Get Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
Location: Melbourne, Australia

anveshita wrote:
I have a question on how low values impact Correlation ID and MQ GET.

As already alluded, there is no concept of 'low values' and MQ Correlation Id.

There is one predefined constant MQCI_NONE that consists of 24 bytes of binary 0. As an input to MQGET, it requests MQ to get a message for any Correl Id.

If you store any other value in Correl Id, it tells MQ to get a message with that specific value.

Note that Correl Id is an array of 24 binary bytes, there is no associated character set and MQ does not do any conversion. Never use string functions to copy or set its value, or try to print the value as characters. If you need to print it, convert each byte to a 2 character hex representation.

The same comments apply to Message Id.

HTH, Glenn.
_________________
Glenn
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 Discussion » question on Correlation ID, Low values and MQ Get
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.