Documentation ¶
Overview ¶
- This is an example of a Go program to get messages from an IBM MQ
- queue. It uses the asynchronous callback operation instead of using
- a synchronous MQGET. *
- The queue and queue manager name can be given as parameters on the
- command line. Defaults are coded in the program. *
- Each MQI call prints its success or failure. *
This is a short sample to show how to connect to a remote queue manager in a Go program without requiring external client configuration such as a CCDT. Only the basic parameters are needed here - channel name and connection information - along with the queue manager name.
For example, run as
amqsconn QMGR1 "SYSTEM.DEF.SVRCONN" "myhost.example.com(1414)"
If the MQSAMP_USER_ID environment variable is set, then a userid/password flow is also made to authenticate to the queue manager.
There is no attempt in this sample to configure advanced security features such TLS.
If an error occurs, the error is reported.
This is a short sample to show how to connect to a remote queue manager in a Go program with a TLS connection without requiring external client configuration such as a CCDT. The basic parameters are still needed here - channel name and connection information - along with the queue manager name.
For example, run as
amqsconn QMGR1 "SYSTEM.SSL.SVRCONN" "myhost.example.com(1414)"
If the MQSAMP_USER_ID environment variable is set, then a userid/password flow is also made to authenticate to the queue manager.
If an error occurs, the error is reported.
This is an example of a Go program to put and get messages to an IBM MQ
queue while manipulating a Dead Letter Header *
The queue and queue manager name can be given as parameters on the
command line. Defaults are coded in the program. *
This is an example of a Go program to browse messages from an IBM MQ
queue. *
The queue and queue manager name can be given as parameters on the
command line. Defaults are coded in the program. *
The program loops until no more messages are on the queue, waiting for
at most 3 seconds for new messages to arrive. *
Each MQI call prints its success or failure. *
This is an example of a Go program to get messages from an IBM MQ
queue. *
The queue and queue manager name can be given as parameters on the
command line. Defaults are coded in the program. *
The program loops until no more messages are on the queue, waiting for
at most 3 seconds for new messages to arrive. *
Each MQI call prints its success or failure. *
A MsgId can be provided as a final optional parameter to this command
in which case we try to retrieve just a single message that matches. *
This is an example of a Go program to inquire on some attributes of some IBM MQ
objects. The program looks at a nominated queue, and also at a NAMELIST *
The queue and queue manager name can be given as parameters on the
command line. Defaults are coded in the program. * *
This is an example of a Go program to put and get messages to an IBM MQ
queue while manipulating the message properties *
While the main body of this sample is the same as the amqsput and amqsget
samples, the important functions to understand here are setProperties and
printProperties. *
The queue and queue manager name can be given as parameters on the
command line. Defaults are coded in the program. *
This is an example of a Go program to publish messages to an IBM MQ
topic. *
The topic and queue manager name can be given as parameters on the
command line. Defaults are coded in the program. *
A single message is published, containing a "hello" and timestamp.
Each MQI call prints its success or failure. *
This is an example of a Go program to put messages to an IBM MQ
queue. *
The queue and queue manager name can be given as parameters on the
command line. Defaults are coded in the program. *
A single message is put, containing a "hello" and timestamp.
Each MQI call prints its success or failure. The MsgId of the
put message is also printed so it can be used as an optional
selection criterion on the amqsget sample program. *
This is an example of a Go program to set some attributes of an IBM MQ
queue through the MQSET verb. The attributes that can be set are limited;
those limitations are described in the MQSET documentation. *
The queue and queue manager name can be given as parameters on the
command line. Defaults are coded in the program. * *
This is an example of a Go program to subscribe to publications from an IBM MQ
topic. *
The topic and queue manager name can be given as parameters on the
command line. Defaults are coded in the program. *
The program loops until no more publications are available, waiting for
at most 3 seconds for new messages to arrive. *
Each MQI call prints its success or failure. *