本文介绍了将无代理的AMQP写入MQTT适配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现一个从amqp到mqtt的适配器,该适配器将接收amqp消息,获取其有效负载并将其作为mqtt消息发布到我的mqtt代理.因此,适配器必须能够

I want to implement an amqp to mqtt adapter, which would receive amqp messages, take their payload and publish it as mqtt messages to my mqtt broker.Therefore the adapter must be able to

  • 在端口上听
  • 确认连接请求
  • 接收amqp消息
  • 确认他们
  • 使用mqtt发布

在我的生态系统中,我想为传入消息提供不同的协议,但是我只想运行一个mqtt代理.我想避免其他经纪人.我在这里 amqp"1.0允许无代理点对点通信".我想这对我的用例来说是正确的(尽管amqp 0-9-1会很好).

In my ecosystem I want to provide different protocols for incoming messages, but I want to run only one mqtt broker. I want to avoid any other broker.I read here that amqp "1.0 permits brokerless point-to-point communication". I guess that would be the right thing for my use case (Although amqp 0-9-1 would be nice).

我很难为此找到解决方法.Rabbitmq客户端库似乎仅用于客户端与代理之间的通信.
我还通过了 qpid 回购.借助他们的经纪人库,我可以在自己的项目中启动嵌入式经纪人,如下所示:此处.那是一个不错的头,但这不是我所需要的.
mqtt的东西对我来说没问题.困扰我的是等待amqp消息"部分.

I have trouble coming up with a approach for this. The rabbitmq client library seems to be only for client to broker communication.
I have also gone through the qpid repo. With their broker library I'm able to start an embedded broker in my own project like shown here. That's a nice gimmick, but is not what I need.
The mqtt stuff is no problem for me. What bothers me is the "wait for amqp messages" part.

我已经研究了几个小时.我在这里瞎吗?还是真的不常见/复杂?
我非常感谢您或网络上关于可能的库或示例的任何建议.

I have been researching for a couple hours. Am I blind here? Or is it really that uncommon/complex?
I would really appreciate any advice on possible libraries or examples from you or the web.

谢谢.

推荐答案

根据您使用的语言,您可以使用Qpid proton-c或proton-j协议引擎,并在内存中实现自己的AMQP 1.0服务器样式组件可以侦听服务器套接字,然后接受传入的AMQP 1.0连接并按您认为合适的方式处理消息.但是,这确实需要您对协议有相当深入的了解,并且要实现一定的逻辑来处理各种客户端行为,因为AMQP 1.0协议具有一般的灵活性,您可能会看到这些行为.

Depending on the language you are using you can use either the Qpid proton-c or proton-j protocol engine and implement your own in memory AMQP 1.0 server style component that can listen on a server socket and then accept incoming AMQP 1.0 connections and deal with the messages as you see fit. This does require you to have a pretty deep understanding of the protocol though and implement a fair bit of logic to deal with the variety of client behaviours you might see given the general flexibility of the AMQP 1.0 protocol.

通过使用ActiveMQ Artemis等众多多协议代理中的一种,或为您处理所有这些事务,您可以省下很多精力.我认为,如果您想按照自己的方式行事,也许可以利用质子C ++或C客户端中的一些更高级别的代码来提供帮助,但这仍然是一项相当大的工作.

You might save yourself a fair bit of effort by using one of the many multi protocol brokers like ActiveMQ Artemis or some such to handle all that for you. I think you might be able to leverage some of the higher level code in the proton C++ or C clients to help if you wanted to go your own way but it will still be a fair bit of work.

这篇关于将无代理的AMQP写入MQTT适配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 13:01