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 IndexIBM MQ Java / JMSput/get with correlation ID

Post new topicReply to topic
put/get with correlation ID View previous topic :: View next topic
Author Message
jmac
PostPosted: Mon Oct 08, 2001 11:11 am Post subject: Reply with quote

Jedi Knight

Joined: 27 Jun 2001
Posts: 3080
Location: EmeriCon, LLC

I am trying to put a message on a queue with a correlation ID, then get the reply message with the same correlation ID. I am not having any luck. My code is basically this:

MQMessage message = new MQMessage();

message.userId = m_strMQUserID;
message.writeString(msgPart1.toString());
if ( m_boolAwaitReply )
{
message.replyToQueueManagerName = m_strQueueManagerReply;
message.replyToQueueName = m_strQueueReply;
m_strCorrelID = "1111111111111111111111111111111111";
message.correlationId = m_strCorrelID.getBytes();
}
MQPutMessageOptions pmo = new MQPutMessageOptions( );
// The SET_IDENTITY_CONTEXT allows you to specify a userid other than
// the logged on user
pmo.options = MQC.MQPMO_SET_IDENTITY_CONTEXT ;

// put the message on the queue
this.xmlQueue.put(message, pmo);

******** Now the get:

MQMessage currentMessage = new MQMessage();
m_strCorrelID = "1111111111111111111111111111111112";
currentMessage.correlationId = m_strCorrelID.getBytes();
MQGetMessageOptions gmo = new MQGetMessageOptions( );
gmo.options = MQC.MQGMO_WAIT;
gmo.waitInterval = MQC.MQWI_UNLIMITED;
mqwfQ.get( currentMessage, gmo );


------------------
As you can see I have intentionally changed the correlid. I would expect that this should now wait forever, since there is no message with that particular correlation ID. IT DOES NOT, I get the reply. Obviously I am doing something silly, I just cant see it.

THANKS


_________________
John McDonald
SYSCOM Inc.
IBM Certified Solutions Expert -
MQSeries Workflow

[ This Message was edited by: jmac on 2001-10-08 12:13 ]

[ This Message was edited by: jmac on 2001-10-08 12:14 ]
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
bduncan
PostPosted: Mon Oct 08, 2001 11:42 am Post subject: Reply with quote

Padawan

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

John,
You are specifying what value you want to match against, but it doesn't look like you are instructing the queue manager to actually match against CorrelId on the MQGET. Here is an exerpt from the Application Programming Reference:

For the MQGET call, MsgId is one of the five fields that can be used to select a particular message to be retrieved from the queue. Normally the MQGET call returns the next message on the queue, but if a particular message is required, this can be obtained by specifying one or more of the five selection criteria, in any combination; these fields are:

MsgId
CorrelId
GroupId
MsgSeqNumber
Offset

The application sets one or more of these field to the values required, and then sets the corresponding MQMO_* match options in the MatchOptions field in MQGMO to indicate that those fields should be used as selection criteria. Only messages that have the specified values in those fields are candidates for retrieval. The default for the MatchOptions field (if not altered by the application) is to match both the message identifier and the correlation identifier.


So I think if you just specify MQMO_MATCH_CORREL_ID in the MatchOptions field of the MQGMO structure, you should get the message you requested.



_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator

[ This Message was edited by: bduncan on 2001-10-08 12:42 ]
Back to top
View user's profile Send private message Visit poster's website AIM Address
jmac
PostPosted: Mon Oct 08, 2001 1:10 pm Post subject: Reply with quote

Jedi Knight

Joined: 27 Jun 2001
Posts: 3080
Location: EmeriCon, LLC

Brandon:

Added the following line to my get code...


gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;


THANKS.... I new it would be a simple fix.

Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ Java / JMSput/get with correlation ID
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.