Tutorial on sending AMQP messages using the Python Zato _python

Source: Internet
Author: User

This Help topic shows what is required to send a AMQP message using Zato. Zato is a Python based enterprise service Bus (ESB) for SOA, converged sing Woo backend services.
Code Demo

Here are some of the code you need:

From Zato.server.service Import Service

Class MyService (Service):
def handle (self):
msg = ' My message '
Conn_name = ' My CRM connection '
Exchange_name = ' My Exchange '
Routing_key = ' '
Self.outgoing.amqp.send (msg, Conn_name, Exchange_name, Routing_key)


Understanding Connection definitions and connections

Before sending the first message, you must let Zato know where to send the message, because by default Zato supports separating the service that generated the message and the actual destination of the message delivery.

In your code, you just call a single. Send method without actually specifying a specific URL or credential, message expiration, content type, and so on. You can specify these, but you don't need to.

All this is done through the connection definition and the true connection. A connection definition is a template that describes the details required to connect to the AMQP agent-the network address of the proxy, the virtual hostname, the username/password, and something like that. Each connection definition can be used to create one or more details that handle sending messages-message priority, distribution mode, and other connections to this message information.


Both types of objects can be created using the Zato graphical interface, or they can be created by other methods such as Enmasse or APIs

Graphical interface

First create a connection definition, and then use it to create an external connection, as shown in the following illustration:

All in all, when you create a new connection and write the code shown earlier, you can hot deploy to send the AMQP message.
other ways to configure

In contrast, alternatively, use the Enmasse tool and API to create, list, update, or delete AMQP connections. is not limited to graphical interface mode.
More examples of Use

Please see the full API and more AMQP use examples here.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.