Step 2: Connecting to the queue manager
Your program can connect either to a specific queue manager or to the default queue manager. In both cases, the queue manager must be local to the task. You can connect to a queue manager in several different ways.
If you instantiated AbtMQqm, you can connect to the queue manager as follows:
Sample Application 1:
| result |
"Sample App 1: connecting to the queue manager instantiated
in step 1 and verifying the connection"
(result := aQueueManager connect) isAbtError
ifTrue: [Transcript show: 'Error making connection'].
"Establish your queue name and the queue manager instance"
(aQueue := AbtMQqueue new)
name : ‘MYUSERID.QUEUE1’ ;
queueManager: aQueueManager.
If you used AbtMQSeriesConnectionSpec in step 1, then you'll want to connect to the queue manager as follows:
Sample Application 2:
| result |
"Sample App 2: instantiating the connection"
anMQConnection := AbtMQConnection new.
"Connect to the queue manager established in step 1 and
verify the connection"
(result := anMQConnection connectUsing: anMQConnectionSpec) isAbtError
ifTrue: [Transcript cr;
nextPutAll: ('Connect error: ', result codesAsString). ^nil].
Either way of connecting to the queue manager is appropriate. When using AbtMQqm, you supply the queue information in the second step. When using AbtMQSeriesConnectionSpec, you supply the queue information in the first step and then connect using that specification. When you use the connectUsing: method in association with a connection specification, the queue is opened for you automatically.
Last modified date: 01/29/2015