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 » matching message using message id

Post new topic  Reply to topic
 matching message using message id « View previous topic :: View next topic » 
Author Message
gauravgeek
PostPosted: Thu May 18, 2006 2:43 am    Post subject: matching message using message id Reply with quote

Newbie

Joined: 18 May 2006
Posts: 4

Hi,

I am posting a message from my application into a queue(PutQueue). I am retaining the message id in a variable(byte array). Another application picks up the message from PutQueue and after performing some processing puts message back into another Queue(say ReceiveQueue) with the same message id it received. My application needs to pickup the message from Receive Queue after matching the message id. Also my application needs to wait for max. 30 seconds(in case receiving application takes time to put message back) after putting the message in send Queue.
I am using the following code.
'send message code
strQueueManagerName = System.Configuration.ConfigurationSettings.AppSettings("QueueManager")
strQueueName = System.Configuration.ConfigurationSettings.AppSettings("SendQueue")
strConnectionName = System.Configuration.ConfigurationSettings.AppSettings("ConnectionName")
strChannelName = System.Configuration.ConfigurationSettings.AppSettings("ChannelName")

MQMsgPutMessage1 = New MQMessage
MQPutMsgOptions = New MQPutMessageOptions
PutQueueManager = New MQQueueManager(strQueueManagerName, strChannelName, strConnectionName)
PutQueue = PutQueueManager.AccessQueue(strQueueName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_OUTPUT + MQC.MQGMO_BROWSE_MSG_UNDER_CURSOR + MQC.MQOO_FAIL_IF_QUIESCING)
MQMsgPutMessage1.Format = MQC.MQFMT_STRING
MQMsgPutMessage1.WriteString(TextBox1.Text)
PutQueue.Put(MQMsgPutMessage1)
bytMessageId1 = MQMsgPutMessage1.MessageId


''''''receive message code
MQMsgMatchMessage = New MQMessage
RQueueManager = New MQQueueManager(strQueueManagerName, strChannelName, strConnectionName)
msgOptions.MatchOptions = MQC.MQMO_MATCH_MSG_ID
msgOptions.Options = MQC.MQGMO_FAIL_IF_QUIESCING Or MQC.MQGMO_WAIT Or MQC.MQGMO_NO_SYNCPOINT
msgOptions.WaitInterval = 90000
'fetch from receive queue
strQueueName = System.Configuration.ConfigurationSettings.AppSettings("ResponseQueue")
RQueue = RQueueManager.AccessQueue(strQueueName, MQC.MQMO_MATCH_MSG_ID Or MQC.MQGMO_WAIT)
MQMsgMatchMessage.MessageId = bytMessageId1
RQueue.Get(MQMsgMatchMessage, msgOptions)
If MQMsgMatchMessage.MessageLength = 0 Then
RemoveMessageFromQueue(RQueueManager, bytMessageId1, strQueueName)
Else
TextBox2.Text = MQMsgMatchMessage.ReadString(MQMsgMatchMessage.MessageLength)
End If

Any response/suggestions would be welcome.

Regards,
Gaurav[quote][/quote]
Back to top
View user's profile Send private message
wschutz
PostPosted: Thu May 18, 2006 6:22 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Is there a question here? For one thing:
Quote:
msgOptions.WaitInterval = 90000
is 90 seconds, not 30 seconds .....

So are you saying its not working and the Get times out
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
gauravgeek
PostPosted: Thu May 18, 2006 6:44 am    Post subject: Reply with quote

Newbie

Joined: 18 May 2006
Posts: 4

Hi,

My code does get the matched message from the Receive queue, instead it gets the first mesage from the receive queue.
About waitinterval, I have modified the interval to 30000, which is to be the actual value.

Regards,
Gaurav
Back to top
View user's profile Send private message
tleichen
PostPosted: Thu May 18, 2006 7:32 am    Post subject: Reply with quote

Yatiri

Joined: 11 Apr 2005
Posts: 663
Location: Center of the USA

Read in the Intercommunication manual about message Id/correlation ID usage.
_________________
IBM Certified MQSeries Specialist
IBM Certified MQSeries Developer
Back to top
View user's profile Send private message
wschutz
PostPosted: Thu May 18, 2006 7:36 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

so what value does MQMsgMatchMessage.MessageId have right before the get? It sounds like it's binary zero's.....
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
gauravgeek
PostPosted: Thu May 18, 2006 7:45 am    Post subject: Reply with quote

Newbie

Joined: 18 May 2006
Posts: 4

Hi,
the MQMsgMatchMessage.MessageId contains following values as a byte array


(0): 65
(1): 77
(2): 81
(3): 32
(4): 67
(5): 83
(6): 66
(7): 95
(8): 84
(9): 69
(10): 83
(11): 84
(12): 32
(13): 32
(14): 32
(15): 32
(16): 230
(17): 24
(18): 104
(19): 68
(20): 32
(21): 0
(22): 68
(23): 1

regards,
Gaurav
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 » matching message using message 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.