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 » Not able to get message based on correlation id

Post new topic  Reply to topic
 Not able to get message based on correlation id « View previous topic :: View next topic » 
Author Message
ragup
PostPosted: Mon Oct 24, 2011 9:00 am    Post subject: Not able to get message based on correlation id Reply with quote

Newbie

Joined: 21 Oct 2011
Posts: 7

Hi,
I have two replies queues called TriggerReply queue and Replydata queue.The TriggerReply Correlation Id and ReplyData correlation id are same.I am first reading correlationId from TriggerReply queue and then this id is assigned to correlationId of the Replydata queue for reading the matching data.

But I am not able to read any data from ReplyData queue based on correlationId match.

TriggerReply queue CorrelationId:
414D512063746E6863616431352E6D714D331ACE0AA8E023

ReplyData queue correlationId :
414D512063746E6863616431352E6D714D331ACE0AA8E023

I am writing the code as shown below(Vb.net)

Code:
public function ReadReplyQueue()
'get correlation id from TriggerReply queue
dim CorrelId() as byte =GetCorrelIdFromTriggerQueue()

objMQQueueManager = New MQQueueManager(inGet.QueueManagerName
objMQQueue = objMQQueueManager.AccessQueue(inGet.GetQueueName, MQC.MQOO_INPUT_SHARED + MQC.MQOO_BROWSE + +MQC.MQOO_FAIL_IF_QUIESCING)
 dim objMQMsg  as New MQMessage()
dim objMQGetMsgOptions  New MQGetMessageOptions()
 objMQGetMsgOptions.Options = MQMessageOption.MQGMO_WAIT + MQC.MQGMO_BROWSE_FIRST
 objMQGetMsgOptions.MatchOptions= MQC.MQMO_MATCH_CORREL_ID
objMQMsg.CorrelationId=CorrelId
objMQMsg.MessageId=" "
objMQGetMsgOptions.WaitInterval = "1000"
 Try
   objMQGetMsgOptions.Options = MQMessageOption.MQGMO_WAIT + MQC.MQGMO_BROWSE_NEXT
 objMQQueue.Get(objMQMsg, objMQGetMsgOptions)
strTemp = objMQMsg.ReadString(objMQMsg.MessageLength)
 Catch ex As MQException
 If ex.ReasonCode = 2033 Then   'Error code for empty queue is 2033.
  If objMQQueue IsNot Nothing AndAlso objMQQueue.IsOpen = True Then
         objMQQueue.Close()
   End If
       objMQMsg = Nothing
       objMQMsgOptions = Nothing
       objMQQueue = Nothing
        objMQQueueManager = Nothing
     Exit While
   End If
 End Try

End Function


Please any one can help me what is wrong in the above code? and why I am not able to read any matching value from queue.


Last edited by ragup on Mon Oct 24, 2011 10:03 am; edited 2 times in total
Back to top
View user's profile Send private message
bruce2359
PostPosted: Mon Oct 24, 2011 9:11 am    Post subject: Re: Not able to get message based on correlation id Reply with quote

Poobah

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

ragup wrote:
I am not able to read any data from ReplyData queue based on correlationId match.


I'm guessing that your app is getting a 2033, yes?

I don't see MATCH options in the GMO that specify only to match on correlid. Could it be that there is an old msgid in the mqmd field that is being matched (failing to match)?
_________________
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
Vitor
PostPosted: Mon Oct 24, 2011 9:15 am    Post subject: Re: Not able to get message based on correlation id Reply with quote

Grand High Poobah

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

ragup wrote:
Please any one can help me what is wrong in the above code?


I don't see where in the code you're requesting the message with that matching correct id. Or understand why you're specifying browse options on the get. Or how you're getting the correl id from the trigger message to use in the queue read.

ragup wrote:
and why I am not able to read any matching value from queue.


Do you get the wrong message? A 2033? A loud bang?

Please a) post the rest of your code b) use [c o d e] tags to increasing legibility.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ragup
PostPosted: Mon Oct 24, 2011 9:17 am    Post subject: Re: Not able to get message based on correlation id Reply with quote

Newbie

Joined: 21 Oct 2011
Posts: 7

Yes .I am getting the error code 2033(No message available)

I have added this line in the code also but not able to get a message
MQC.MQMO_MATCH_CORREL_ID
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Oct 24, 2011 9:21 am    Post subject: Re: Not able to get message based on correlation id Reply with quote

Grand High Poobah

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

ragup wrote:
I have added this line in the code also but not able to get a message
MQC.MQMO_MATCH_CORREL_ID


Where? You set the options twice.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Oct 24, 2011 9:48 am    Post subject: Reply with quote

Grand High Poobah

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

This is the offending line:
Code:
objMQMsg.MessageId=" "


You would need to set it to MQC.MQMI_NONE.

You are in fact looking for a message with the correlid specified AND a messageId of " "... You would need to look at that in hex to see if it makes any sense...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ragup
PostPosted: Mon Oct 24, 2011 9:50 am    Post subject: Re: Not able to get message based on correlation id Reply with quote

Newbie

Joined: 21 Oct 2011
Posts: 7

I want to browse the message without remove data from queue after read that's why I am using BROWSE options.

I am getting the error code 2033(No message available in the queue)

This is the function to get the correlationId from Triggerreply queue.

Code:
public function GetCorrelIdFromTriggerQueue()
dim correlid() as byte
objMQQueueManager = New MQQueueManager(queuemanagerName)      
objMQQueue = objMQQueueManager.AccessQueue(inGet.GetQueueName, MQC.MQOO_INPUT_SHARED + MQC.MQOO_FAIL_IF_QUIESCING)
Dim objMQMsg as New MQMessage()
Dim objMQGetMsgOptions New MQGetMessageOptions()
objMQGetMsgOptions.Options = MQMessageOption.MQGMO_WAIT
objMQGetMsgOptions.MatchOptions=MQMO_NONE

objMQMsg.MQC.MQFMT_STRING
objMQMsg.CorrelationId =" "
objMQMsg.MessageId =" "
objMQGetMsgOptions.WaitInterval = "1000"

While True                                       
    Try
                       
      objMQQueue.Get(objMQMsg, objMQGetMsgOptions)
      strTemp = objMQMsg.ReadString(objMQMsg.MessageLength)
      correlid=objMQMsg.CorrelationId
      objMQQueueManager.Commit()
     Catch ex As MQException
        If ex.ReasonCode = 2033 Then   'Error code for empty queue is 2033.
        If objMQQueue IsNot Nothing AndAlso objMQQueue.IsOpen = True Then
          objMQQueue.Close()
        End If
       objMQMsg = Nothing
        objMQMsgOptions = Nothing
        objMQQueue = Nothing
        objMQQueueManager = Nothing
    Exit While
   End If
  End Try
return correlid
End function


Last edited by ragup on Mon Oct 24, 2011 10:02 am; edited 1 time in total
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Oct 24, 2011 9:56 am    Post subject: Reply with quote

Grand High Poobah

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

your initialization of the correlId and msgId is plain wrong! see my earlier post. Also you need to reinitialize the msgId and correlId for each loop before the get....

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ragup
PostPosted: Mon Oct 24, 2011 10:01 am    Post subject: Re: Not able to get message based on correlation id Reply with quote

Newbie

Joined: 21 Oct 2011
Posts: 7

sorry that's my mistake.

the code should be a
objMQGetMsgOptions.MatchOptions= MQC.MQMO_MATCH_CORREL_ID

instead of
objMQGetMsgOptions.Options = MQC.MQMO_MATCH_CORREL_ID
Back to top
View user's profile Send private message
ragup
PostPosted: Mon Oct 24, 2011 10:04 am    Post subject: Reply with quote

Newbie

Joined: 21 Oct 2011
Posts: 7

Sorry I am not able to understand.

can you please give more details about this one?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Oct 24, 2011 10:11 am    Post subject: Reply with quote

Grand High Poobah

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

Instead of trying things left and right that are prone to not change much ,
the posts that you have been given yet, better them and
the programming manual and reference as well as the request reply samples
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Not able to get message based on 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.