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 » VB.NET Question...

Post new topic  Reply to topic
 VB.NET Question... « View previous topic :: View next topic » 
Author Message
jjm335
PostPosted: Fri Sep 29, 2006 9:49 am    Post subject: VB.NET Question... Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Sep 29, 2006 10:11 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzal.doc/partmsg.htm

There shouldn't be a replytoQueue and replytoQueueManager on the reply message, only on the request. So if you need, somehow, to save this between sending the request and getting the reply... just keep it in a variable.
_________________
I am *not* the model of the modern major general.
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 » VB.NET Question...
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.