IBM MQ outgoing connections

Overview

Sends a message to an IBM MQ queue manager using connection parameters specified.

The application on the receiving end may be written in Java using MQ JMS API. This allows for seamless integration with Java JMS MQ systems - from their point of view Zato, despite being written in Python, will appear to be a Java application.

Note

Before making using of the connections, PyMQI needs to be first manually enabled by administrators.

API

self.outgoing.ibm_mq.send

send(msg, out_name, queue, delivery_mode=None, expiration=None, priority=None, max_chars_printed=None):

Uses an outgoing connection of a given name to send a message to an IBM MQ queue manager.

Parameters:
  • msg (string) – Message to send
  • out_name (string) – Outgoing connection to use
  • queue (string) – Name of the queue to put a message on
  • delivery_mode (DELIVERY_MODE_NON_PERSISTENT or DELIVERY_MODE_PERSISTENT from the springpython.jms module) – Whether the message should be persistent or not
  • expiration (int) – After how many milliseconds after reaching the queue should the message expire
  • priority (int) – Message priority between 1 and 9 - 1 being the minimum priority
  • max_chars_printed (int) – How many characters of the message should Spring Python write out to logs when running in DEBUG mode
Return type:

(None)

Usage example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from zato.server.service import Service

class MyService(Service):
    def handle(self):

        # Request parameters
        msg = 'Hello MQ!'
        out_name = 'Customer Cases'
        queue = 'CUSTOMER.CASES.1'

        # Send the message to a queue manager
        self.outgoing.ibm_mq.send(msg, out_name, queue)