segunda-feira, 22 de julho de 2013

How to access MQSeries using VB6

Hi!

First of all you have to find the following reference and add to your vb project.

REFERENCE

IBM MQSeries Automation Classes for Activex

Once you did it, do the following

* * *

Sub AccessMQSeriesByNetdaniels()

On Error GoTo TrataErro

Dim MQSess As New MQSession
Dim QMgr As New MQQueueManager
Dim Queue As MQQueue
Dim msg As MQMessage
Dim pmo As MQPutMessageOptions
Dim MQDList As MQDistributionList

STEP 1
Set MQSess = New MQSession

Set QMgr = MQSess.AccessQueueManager("QM.000000.01")

MsgBox "I was able to connect to the queue manager"

STEP 2

Set Queue = QMgr.AccessQueue("QL.XXXXXXXXX.01", MQOO_INPUT_AS_Q_DEF, "QM.000000.01")

MsgBox "Queue was created"

STEP 3

Call msg.Write("Queue test" & Now)

MsgBox "I was able to write a message"

STEP 4

Queue.Open

MsgBox "I was able to open the queue"

STEP 5

Queue.Put msg

MsgBox "Put was successfully"

Exit Sub

TrataErro:

MsgBox Err.Description

End Sub

* * *  
Et voilà!


A very simple code for you to test your connection with MQSeries!


How simple is that?

Nenhum comentário:

Postar um comentário