Step 4: Putting messages on a queue
Use the AbtMQMessage class to specify the message options. Then you can put the message on the queue using a variety of put... methods.
| inMsg aMessage aQueue result |
"Sample App 1: Defining the message"
(aMessage := AbtMQMessage fromBytes: ('A test message' asByteArray))
msgType: MqmtDatagram;
replyToQ: 'MYUSERID.QUEUE1'.
"Put the message on the queue opened in step 3 and verify the call"
(result := aQueue putMessageWithDefaultOptions: aMessage) isAbtError
ifTrue: [Transcript show: 'Error putting message on queue'].
Similarly, Sample Application 2 uses the AbtMQMessage class to specify the message options:
| result aMessage anMQConnectionSpec |
"Sample App 2: Defining the message"
(aMessage := AbtMQMessage
fromBytes: ('Sample App 2 test message' asByteArray))
msgType: MqmtDatagram;
replyToQ: anMQConnectionSpec requestQueueName.
"Put the message on the queue opened with the connectUsing: method
and verify the call"
(result := anMQConnection putMQMessage: aMessage) isAbtError
ifTrue: [result display].
Last modified date: 01/29/2015