Python IBM MQ

Dashboard

  • No knowledge of IBM MQ programming is needed to receive messages from IBM MQ queues or to send them
  • Connections are defined in the platform's Dashboard, as below:

Receiving messages from queues

Create an IBM MQ definition and channel and a given service will be invoked for each message taken off a queue. The request, stripped off the MQRFH2 JMS headers, will be in self.request.payload.

# -*- coding: utf-8 -*-

# Zato
from zato.server.service import Service

class MyService(Service):

    def handle(self):
        self.logger.info('Message received: %s', self.request.payload)

Sending messages to queues

Create an IBM MQ definition and outgoing IBM MQ connection and send a message like in the example below.

MQRFH2 JMS headers can be added by Zato so that from the receiving side everything seamlessly appears as though Zato was a Java application.

# -*- coding: utf-8 -*-

# Zato
from zato.server.service import Service

class MyService(Service):

    def handle(self):
        self.outgoing.ibm_mq.send('my-message', 'outgoing-connection-name', 'QUEUE.1')


Schedule a meaningful demo

Book a demo with an expert who will help you build meaningful systems that match your ambitions

"For me, Zato Source is the only technology partner to help with operational improvements."

— John Adams
Program Manager of Channel Enablement at Keysight