Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java/Python communication via message broker

What is a good solution for communication via message broker that supports both (C)Python and Java/JMS applications? My particular requirements are:

  • open source solution
  • Available on Linux-based systems
  • No rendezvous between sender and receiver required (i.e. uses a message broker)
  • Multiple producers and consumers supported for a single event queue (only one consumer receives each message)
  • Unit of work support with two-phase commit (XA support nice to have)
  • Support for persistent messages (i.e. that survive a restart of the broker)
  • Supports JMS for Java clients
  • No component is "fringe", meaning at risk of falling out of maintenance due to lack of community support/interest
  • If there is a Python client that manages to "speak JMS" that would be awesome, but an answer including a task to write my own Python JMS layer is acceptable

I have had a surprisingly hard time finding a solution for this. Apache's ActiveMQ has no Python support out of the box. ZeroMQ requires a rendezvous. RabbitMQ does not appear to support JMS. The best candidate I have found is a combination of ActiveMQ and the pyactivemq library. But the first and last release of pyactivemq was in 2008, so it would appear that that fails my "no fringe" requirement.

The ideal answer will be the names of one or more well-supported and well-documented open source packages, that you have personally used to communicate between a Java/JMS and Python application, and that do not require a lot of integration work to get started. An answer that includes an "easy" (up to a few days of work) implementation of additional glue code to meet all the requirements above, would be acceptable. A commercial solution, in the absence of a good open source candidate, would be acceptable also.

Also, Jython is out. (If only I could...) The same Python applications will need to use modules only available in CPython.

like image 359
wberry Avatar asked Jul 01 '11 18:07

wberry


People also ask

What is a message broker Java?

The message broker's primary function is to validate, transform, and route messages between applications as it mediates between the applications sending and receiving messages from and to each other.

What is Message Broker Python?

The main purpose of a message broker is to take incoming messages from applications and perform some action on them. Although this was a simple example to build a Python Message Queue and send a message, you can use this article as a base to further build more complex workflows with Python Message Queues.

Does Python support JMS?

JMS messages sent and received by a Spring Python powered application are no different than messages produced and consumed by Java applications, in fact, you can use Spring Python and JMS with no Java applications participating in message exchanging at all.

What is JMS and how it works?

The Java Message Service (JMS) API is a messaging standard that allows application components based on the Java Platform Enterprise Edition (Java EE) to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous.


2 Answers

JMS is a specification not implementation . RabbitMQ is a really option .

I have also happily used HornetQ http://www.jboss.org/hornetq from Jboss as with every thing it is more aligned with every thing Java EE but RabbitMQ would be choice espcially if you are using Spring as well

like image 198
Shahzeb Avatar answered Sep 28 '22 04:09

Shahzeb


I have had a surprisingly hard time finding a solution for this. Apache's ActiveMQ has no Python support out of the box.

ActiveMQ brokers fully support using the Stomp protocol out of the box. Stomp is a text based protocol for messaging that has clients for many platforms and languages.

ActiveMQ's documentation should contain information on how to set up a connector for stomp. In its simplest form, enabling a connector would look something like:

<transportConnectors>
   <transportConnector name="stomp" uri="stomp://localhost:61613"/>
</transportConnectors>

Once enabled on the broker side, you can then use any python library that supports stomp. You can then use Stomp on the python side and JMS on the java side for communication with the broker and sending/receiving from specific destinations.

like image 26
whaley Avatar answered Sep 28 '22 05:09

whaley