|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
VB.NET Question... |
« View previous topic :: View next topic » |
Author |
Message
|
jjm335 |
Posted: Fri Sep 29, 2006 9:49 am Post subject: VB.NET Question... |
|
|
Newbie
Joined: 29 Sep 2006 Posts: 4
|
I wrote a WebService in VB.NET that creates an XML message and places it on a MQ Queue. The message in then mapped to another Queue where the message is picked up, processed, and another message is sent back with the returned data from the process. I have two questions regarding my VB.NET process:
1. The Message Id is moved to the Correlation Id after it is processed and a reply is sent back, how do I pull off the reply message based off of the Correlation Id?
2. I would like to maintain the ReplyToQueue and ReplyToQueueManager throughout the message, is there any option I need to set so that is preserved throughout the whole process?
Code:
Code: |
Dim mqQMgr As MQQueueManager
Dim mqSendQueue As MQQueue
Dim mqReceiveQueue As MQQueue
Dim mqMsg As MQMessage
Dim mqPutMsgOpts As MQPutMessageOptions
Dim mqGetMsgOpts As MQGetMessageOptions
Dim isContinue As Boolean = True
'
'Attempt to Connect to the MQ Queue Manager
'
Try
mqQMgr = New MQQueueManager(gMQMgrName, gMQMgrName, gMQConName & "(" & gMQPortNum & ")")
Catch mqe As IBM.WMQ.MQException
isContinue = False
End Try
If (isContinue) Then
'
'Try to open the Send Queue to perform the Put
'
Try
mqSendQueue = mqQMgr.AccessQueue(gSendQueue, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING)
Catch mqe As IBM.WMQ.MQException
isContinue = False
End Try
End If
If (isContinue = True) Then
mqMsg = New MQMessage
mqMsg.Format = MQC.MQFMT_STRING
mqMsg.Encoding = MQC.MQENC_NATIVE
mqMsg.CharacterSet = 819
mqMsg.Persistence = False
mqMsg.ReplyToQueueManagerName = gMQMgrName
mqMsg.ReplyToQueueName = gReceiveQueue
mqMsg.WriteString(mStrMsg)
mqPutMsgOpts = New MQPutMessageOptions
'
'Try to Put the message on the Send Queue
'
Try
mqSendQueue.Put(mqMsg, mqPutMsgOpts)
Catch mqe As IBM.WMQ.MQException
isContinue = False
End Try
End If
If (isContinue) Then
'
'Try to open the Receive Queue to perform the Get
'
Try
mqReceiveQueue = mqQMgr.AccessQueue(gReceiveQueue, MQC.MQOO_OUTPUT Or MQC.MQOO_INPUT_SHARED Or MQC.MQOO_INQUIRE)
Catch mqe As IBM.WMQ.MQException
isContinue = False
End Try
End If
If (isContinue = True) Then
mqGetMsgOpts = New MQGetMessageOptions
mqGetMsgOpts.WaitInterval = 30000
mqGetMsgOpts.Options = MQC.MQGMO_NO_SYNCPOINT + MQC.MQGMO_CONVERT + MQC.MQGMO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING
'
'Try to Get the message on the Receive Queue
'
Try
mqReceiveQueue.Get(mqMsg, mqGetMsgOpts)
If (mqMsg.Format.CompareTo(MQC.MQFMT_STRING) = 0) Then
'Do Something
Else
'Non-text message
End If
Catch mqe As IBM.WMQ.MQException
isContinue = False
End Try
End If
|
Any samples would be great, I'm very new at this. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Sep 29, 2006 10:11 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
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
|
|
|
|