+

Search Tips | Advanced Search

Queue manager QM1 example for IBM i

The following object definitions allow applications connected to queue manager QM1 to send request messages to a queue called PAYROLL on QM2, and to receive replies on a queue called PAYROLL.REPLY on QM1.

All the object definitions have been provided with the TEXT attributes. The other attributes supplied are the minimum required to make the example work. The attributes that are not supplied take the default values for queue manager QM1.

Run the following commands on queue manager QM1:

    Remote queue definition
    The CRTMQMQ command with the following attributes:

    QNAME 'PAYROLL.QUERY'
    QTYPE *RMT
    TEXT 'Remote queue for QM2'
    PUTENBL *YES
    TMQNAME 'QM2' (default = remote queue manager name)
    RMTQNAME 'PAYROLL'
    RMTMQMNAME 'QM2'
    Note: The remote queue definition is not a physical queue, but a means of directing messages to the transmission queue, QM2, so that they can be sent to queue manager QM2.

    Transmission queue definition
    The CRTMQMQ command with the following attributes:

    QNAME QM2
    QTYPE *LCL
    TEXT 'Transmission queue to QM2'
    USAGE *TMQ
    PUTENBL *YES
    GETENBL *YES
    TRGENBL *YES
    TRGTYPE *FIRST
    INITQNAME SYSTEM.CHANNEL.INITQ
    TRIGDATA QM1.TO.QM2

    When the first message is put on this transmission queue, a trigger message is sent to the initiation queue, SYSTEM.CHANNEL.INITQ. The channel initiator gets the message from the initiation queue and starts the channel identified in the named process.

    Sender channel definition
    The CRTMQMCHL command with the following attributes:

    CHLNAME QM1.TO.QM2
    CHLTYPE *SDR
    TRPTYPE *TCP
    TEXT 'Sender channel to QM2'
    TMQNAME QM2
    CONNAME '192.0.2.1(1412)'

    Receiver channel definition
    The CRTMQMCHL command with the following attributes:

    CHLNAME QM2.TO.QM1
    CHLTYPE *RCVR
    TRPTYPE *TCP
    TEXT 'Receiver channel from QM2'

    Reply-to queue definition
    The CRTMQMQ command with the following attributes:

    QNAME PAYROLL.REPLY
    QTYPE *LCL
    TEXT 'Reply queue for replies to query messages sent to QM2'
    PUTENBL *YES
    GETENBL *YES

    The reply-to queue is defined as PUT(ENABLED). This definition ensures that reply messages can be put to the queue. If the replies cannot be put to the reply-to queue, they are sent to the dead-letter queue on QM1 or, if this queue is not available, remain on transmission queue QM1 on queue manager QM2. The queue has been defined as GET(ENABLED) to allow the reply messages to be retrieved.

Parent topic: What the example for IBM i shows

Last updated: 2020-10-04