Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IBM MQ messaging automation
#3
Solved: 8 Years, 1 Month, 1 Week ago
Try this code:

Code:
Dim oMQEnvironment
    Dim oMQM
    Dim oMQC
    Dim oMQMessage
    Dim oMQQueue
    Dim intOpenOptions

'YOUR MQ DETAILS AND MESSAGE

    'strMQMDLLPath = "C:\\Program Files (x86)\\IBM\WebSphere MQ\\bin\\amqmdnet.dll"
    'strHostName= "Host Name"
    'intPort = "Port Number"
    'strChannel ="Channel Name"
    'strMessage ="UFT Test Message"
    'strMQManager = "Quemanager Name"
    'strMessageQueue = "Queue Name"

               
'              Create MQ Instances
               Set oMQC = DotnetFactory.CreateInstance("IBM.WMQ.MQC",strMQMDLLPath)

               'set the properties of the Queue manager
               Set properties = DotNetFactory.CreateInstance("System.Collections.Hashtable")
                properties.Add oMQC.HOST_NAME_PROPERTY, strHostName
                properties.Add oMQC.PORT_PROPERTY, intPort
                properties.Add oMQC.CHANNEL_PROPERTY, strChannel

               'access the queue manager 
               Set oMQM = DotnetFactory.CreateInstance("IBM.WMQ.MQQueueManager",strMQMDLLPath,strMQManager,properties)

    'Check if MQM Connected
    If Err.Number <> 0 Then
        Reporter.ReportEvent micFail , "Step: Creating MQM Object" , "Unable to Connect to MQ Manager at" & strHostName
        'Exit Test
    End If

    Set oMQC = DotnetFactory.CreateInstance("IBM.WMQ.MQC",strMQMDLLPath)
    Set oMQMessage = DotnetFactory.CreateInstance("IBM.WMQ.MQMessage",strMQMDLLPath)

    'Declare Q open options
    intOpenOptions = oMQC.MQOO_OUTPUT or oMQC.MQOO_FAIL_IF_QUIESCING ' 16 + 8192

    'Open the Q to post the messages
    If strRemoteMQManager = "" Then
    Set oMQQueue = oMQM.AccessQueue(strMessageQueue , intOpenOptions)
    Else 
    Set oMQQueue = oMQM.AccessQueue(strMessageQueue , intOpenOptions ,strRemoteMQManager, "","" )
    End If

    'Format Message
    With oMQMessage
    .CharacterSet = 819
    .WriteString(strMessage)
    End with

    'Post Message
   With oMQQueue
  .Put(oMQMessage)
   .Close()
   End With
Reply


Messages In This Thread
IBM MQ messaging automation - by siteshag - 07-14-2014, 05:26 PM
RE: IBM MQ messaging automation - by maruthisunil - 10-11-2016, 11:08 PM
RE: IBM MQ messaging automation - by jayant - 10-13-2016, 05:38 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)