|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
matching message using message id |
« View previous topic :: View next topic » |
Author |
Message
|
gauravgeek |
Posted: Thu May 18, 2006 2:43 am Post subject: matching message using message id |
|
|
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 |
|
 |
wschutz |
Posted: Thu May 18, 2006 6:22 am Post subject: |
|
|
 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 |
|
 |
gauravgeek |
Posted: Thu May 18, 2006 6:44 am Post subject: |
|
|
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 |
|
 |
tleichen |
Posted: Thu May 18, 2006 7:32 am Post subject: |
|
|
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 |
|
 |
wschutz |
Posted: Thu May 18, 2006 7:36 am Post subject: |
|
|
 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 |
|
 |
gauravgeek |
Posted: Thu May 18, 2006 7:45 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|