DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • Part 3 of My OCP Journey: Practical Tips and Examples
  • Building a Robust Data Engineering Pipeline in the Streaming Media Industry: An Insider’s Perspective
  • Mastering Go-Templates in Ansible With Jinja2
  • Unlocking Game Development: A Review of ‘Learning C# By Developing Games With Unity'

Trending

  • Part 3 of My OCP Journey: Practical Tips and Examples
  • Building a Robust Data Engineering Pipeline in the Streaming Media Industry: An Insider’s Perspective
  • Mastering Go-Templates in Ansible With Jinja2
  • Unlocking Game Development: A Review of ‘Learning C# By Developing Games With Unity'
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Integrate ZeroMQ, AMQP, JMS WebSphere MQ and more in 2 lines of Python code with Zato

Integrate ZeroMQ, AMQP, JMS WebSphere MQ and more in 2 lines of Python code with Zato

Dariusz Suchojad user avatar by
Dariusz Suchojad
·
Aug. 09, 13 · Interview
Like (1)
Save
Tweet
Share
7.51K Views

Join the DZone community and get the full member experience.

Join For Free

As suggested on the zeromq-dev list, here's an integration example making use of ZeroMQ.

The code

Say you need to forward messages sent from ZeroMQ-based apps to AMQP and JMS WebSphere MQ ones.

No message transformation, no enrichment, validations - simply connect several incompatible technologies and, possibly, programming languages (let's say ZeroMQ the one is in C++, AMQP is in Python and JMS is, unsurprisingly, in Java), like in the diagram below.

Sample integration using Zato - ZeroMQ, AMQP and JMS WebSphere MQ

This is all the code that is needed. Two lines in addition to an import and class/method definition.

from zato.server.service import Service

class MyService(Service):
    def handle(self):
        
        # JMS WebSphere MQ
        self.outgoing.jms_wmq.conn.send(self.request.payload, 'JMS MQ app', 'QUEUE.1')

        # AMQP
        self.outgoing.amqp.conn.send(self.request.payload, 'AMQP app', 'EXCH.1', '/')


The philosophy

Zato is an open-source middleware/ESB (Enterprise Service Bus) and backend server in Python designed for connecting other applications and creating systems of systems. In other words - for working in SOA - Service Oriented Architecture.

You create interesting, reusable, atomic and loosely-coupled services that are shielded from underlying technologies, transport methods or data formats. You can trivially access raw requests but you usually don't need to, you work on a higher level.

Services can be simultaneously exposed over independent channels, each possibly using different data format, transport method or security definition.

Almost everything in Zato is hot-deployed and hot-reconfigured.  Restarts are rarely needed.

You can use GUI, CLI, API or (for DevOps folks seeking repeatable builds) manage objects en masse using a JSON config.

Let's use the GUI in this blog post. Three things will be needed:

  • a ZeroMQ channel for incomming messages
  • an outgoing AMQP connection
  • an outgoing JMS WebSphere MQ connection

After filling out the forms like below a service can be hot-deployed and is ready to use.

And more

What if out of a sudden another application needs to push data, say, through HTTP (which as of Zato 1.1 happens to be the only way to invoke services synchronously), using SOAP, JSON or anything?

You'll have to create a new HTTP channel, using GUI or other tools, and that's it. The service will have now been exposed through another channel, servers are automatically reconfigured and you can start invoking the service from HTTP, no restarts are needed.

You can also check the service's source code directly in the browser, browse its statistics and do more using the GUI, CLI or API.

What's next?

This was only a very simple example of a pass-through router.  Zato can do much more.  Please have a look programming examples, architecture, intro to ESB/SOA and more documentation over here.

Zato has HTTP, JSON, SOAP, SQL, AMQP, JMS WebSphere MQ, ZeroMQ, Redis NoSQL, FTP, browser-based GUI, CLI, API, security, statistics, job scheduling, load-balancing, hot-deployment and a lot of docs to cover everything.

The tutorial will quickly help you get started using a scaled-down real-world integration example.

Please check out the support page if you'd like to chat or need assistance with anything.

ZeroMQ Python (language) Integration

Published at DZone with permission of Dariusz Suchojad. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Part 3 of My OCP Journey: Practical Tips and Examples
  • Building a Robust Data Engineering Pipeline in the Streaming Media Industry: An Insider’s Perspective
  • Mastering Go-Templates in Ansible With Jinja2
  • Unlocking Game Development: A Review of ‘Learning C# By Developing Games With Unity'

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: