通过消息代理进行 Java/Python 通信

发布于 2024-11-18 06:11:10 字数 859 浏览 5 评论 0原文

通过支持 (C)Python 和 Java/JMS 应用程序的消息代理进行通信的良好解决方案是什么?我的具体要求是:

  • 开源解决方案
  • 可在基于 Linux 的系统上使用
  • 发送方和接收方之间不需要会合(即使用消息代理)
  • 单个事件队列支持多个生产者和消费者(每条消息只有一个消费者接收)
  • 工作单元支持具有两阶段提交(最好有 XA 支持)
  • 支持持久消息(即在代理重新启动后仍然存在)
  • 支持 Java 客户端的 JMS
  • 没有组件是“边缘”组件,这意味着由于缺乏组件而面临无法维护的风险社区支持/兴趣
  • 如果有一个能够“讲 JMS”的 Python 客户端真是太棒了,但是包含编写我自己的 Python JMS 层的任务的答案是可以接受的,

为此我遇到了令人惊讶的困难找到解决方案。 Apache 的 ActiveMQ 不提供开箱即用的 Python 支持。 ZeroMQ 需要一个集合点。 RabbitMQ 似乎不支持 JMS。我发现的最佳候选者是 ActiveMQ 和 pyactivemq 库的组合。但 pyactivemq 的第一个也是最后一个版本是在 2008 年,所以看起来这不符合我的“无边缘”要求。

理想的答案是一个或多个受良好支持且文档齐全的开源包的名称,您个人曾使用这些包在 Java/JMS 和 Python 应用程序之间进行通信,并且不需要进行大量集成工作即可获得这些包的名称。开始了。包含“简单”(最多几天的工作)实现附加粘合代码以满足上述所有要求的答案是可以接受的。在没有好的开源候选者的情况下,商业解决方案也是可以接受的。

另外,Jython 也已退出。 (如果我可以的话……)相同的 Python 应用程序将需要使用仅在 CPython 中可用的模块。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

何以畏孤独 2024-11-25 06:11:10

JMS 是一个规范而不是实现。 RabbitMQ 确实是一个选择。

我也很高兴使用 Jboss 的 HornetQ http://www.jboss.org/hornetq ,就像所有事情一样它与 Java EE 的所有方面都更加一致,但 RabbitMQ 是您的选择,特别是如果您也使用 Spring

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

记忆消瘦 2024-11-25 06:11:10

我很难找到解决方案。
Apache 的 ActiveMQ 没有开箱即用的 Python 支持。

ActiveMQ 代理完全支持使用开箱即用的 Stomp 协议。 Stomp 是一种基于文本的消息传递协议,拥有适用于多种平台和语言的客户端。

ActiveMQ 的文档应该包含有关如何为 stomp 设置连接器的信息。在最简单的形式中,启用连接器看起来像这样:

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

在代理端启用后,您就可以使用任何支持 stomp 的 python 库。然后,您可以在 python 端使用 Stomp 并在 java 端使用 JMS 与代理通信并从特定目的地发送/接收。

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.

莳間冲淡了誓言ζ 2024-11-25 06:11:10

您可能想看看OpenAMQ,再看看OpenAMQ。 rabbitmq.com/" rel="nofollow">RabbitMQ.

RabbitMQ 和 OpenAMQ 使用的底层消息传递技术是 AMQP。您应该能够轻松找到适用于这两个代理(以及表面上任何其他符合规范的代理)的 Python 和 Java 客户端。

如果 JMS 是必备的,那么您也许能够找到一个在 AMQP 之上实现的 JMS 客户端(OpenAMQ 曾经提供过这样一个客户端,但我不确定它当前的状态)。

You might want to take a look at OpenAMQ and another look at RabbitMQ.

The underlying messaging technology used by RabbitMQ and OpenAMQ is AMQP. You should be able to easily find Python and Java clients that work against both of these brokers (and ostensibly any other spec-compliant broker).

If JMS is a must-have, then you might be able to find a JMS client out there implemented on top of AMQP (OpenAMQ provided such a client at one time, but I am unsure of its current status).

断舍离 2024-11-25 06:11:10

我们一直在使用 GlassFish 消息队列 (以前的 Sun Java MQ) - 它继承自 OpenMQ

它满足您的大部分要求,如果不是全部。
我们一直在 Red Hat Linux (RHEL) 中使用故障转移集群代理 - 它对于大量使用来说是可靠的。尽管到处都潜伏着一些“怪癖”。

We had been using GlassFish Message Queue (formerly Sun Java MQ) - it is inherited from OpenMQ

It satisfies most of your requirements, if not all.
We had been using fail over-clustered brokers in Red Hat Linux (RHEL) - it is reliable for heavy usage. Though some 'quirks' lurk here and there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文