ActiveMQ 到 Apollo 的转换,Openwire 到 Stomp 的协议配置 [英] ActiveMQ to Apollo transition, Openwire to Stomp protocol configuration

查看:30
本文介绍了ActiveMQ 到 Apollo 的转换,Openwire 到 Stomp 的协议配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 ActiveMQ 5.6 切换到 Apollo 1.5.我有两个软件正在交换消息,使用发布/订阅主题.

  • 第一个是 c++ 并且使用 openwire 和 tcp
  • 第二个是 Javascript 并使用带有 websockets 的 stomp

使用 ActiveMQ 一切正常,我发送的消息可以在两个软件上读写,此后我没有更改客户端.

现在,我从 c++ soft(使用 openwire)发送消息,并尝试使用 JS soft 读取它们,但出现错误.事实上,我收到的消息的标题内容类型为:protocol/openwire",但我希望是 stomp.

这是我配置 apollo.xml 连接器部分的方式:

<openwire max_inactivity_duration="-1" max_inactivity_duration_delay="-1"/><stomp max_header_length="10000" die_delay="-1"/></连接器><connector id="ws" bind="tcp://0.0.0.0:61623"><stomp max_header_length="10000" die_delay="-1"/></连接器>

我也尝试在 tcp 和 ws 连接器中使用 <detect/>,它应该自动检测客户端协议,但也不起作用.

有人可以帮我解决这个问题吗?

谢谢,

<小时>

我发现我确实收到了 stomp 协议消息,但它们的格式非常奇怪,甚至包含非文本字符,使 stomp.js 无法解析消息并正确填充消息正文.

这里是从 activemq openwire 收到一次相同的消息,然后使用相同的 c++ 发布者和 js 订阅者接收 apollo openwire :

activemq

<前>信息消息 ID:ID:myID-61443-1352999572576-0:0:0:0:0类:Message.PointToPoint目的地:/主题/我的主题时间戳:1352999626186过期:0订阅:sub-0优先级:4<PointToPoint xmlns="消息" ><SourceId>u_23</SourceId><TargetId>u_75</TargetId></PointToPoint>"

阿波罗

<前>信息订阅:sub-0目的地:内容长度:331内容类型:协议/openwire消息 ID:xps-broker-291Eç{#ID:myID-61463-1352999939140-0:0emy-topicn{#ID:myID-61463-1352999939140-0:0;Å??<PointToPoint xmlns="Message" ><SourceId>u_23</SourceId>u_75</TargetId></PointToPoint>(类 Message.PointToPoint"

您认为 Apollo 中可能存在问题吗?

解决方案

ActiveMQ 5.6 处理将逻辑 OpenWire 消息转换为 STOMP 客户端的文本表示.Apollo,目前还不支持该功能!:(见:

https://issues.apache.org/jira/browse/APLO-267

它只需要完整的 openwire 消息并将其用作 STOMP 消息的正文.顺便说一句,只要内容长度标头设置正确,在 STOMP 消息中使用二进制数据是完全有效的.

I'm trying to switch from ActiveMQ 5.6 to Apollo 1.5. I have two soft that are exchanging messages, using publish/subscribe on topics.

  • The first one is c++ and use openwire with tcp
  • The second one is Javascript and use stomp with websockets

With ActiveMQ everything worked fine, and the messages I sent could be read and write on both softs, and I didn't changed the clients since.

Now, I send messages from the c++ soft (using openwire), and try to read them with the JS soft, and I get errors. In fact I receive message with header content-type: "protocol/openwire", but I expect stomp.

this is how I configured apollo.xml connector section :

<connector id="tcp" bind="tcp://0.0.0.0:61613">
    <openwire max_inactivity_duration="-1" max_inactivity_duration_delay="-1" />
    <stomp max_header_length="10000" die_delay="-1" />
</connector>
<connector id="ws" bind="tcp://0.0.0.0:61623">
    <stomp max_header_length="10000" die_delay="-1" />
</connector>

I also tried with <detect /> in tcp and ws connector, that is supposed to auto detect client protocol, but dosen't work either.

Does someone can help me to figure this out ?

Thank you,


edit :

I found out that I do receive stomp protocol messages, but they are very weirdly formated, and even contains non text char that make stomp.js fail to parse the message and correctly fill the message body.

here are the same message received once from activemq openwire and then apollo openwire in with the same c++ publisher and js subscriber :

activemq

    "MESSAGE
    message-id:ID:myID-61443-1352999572576-0:0:0:0:0
    class:Message.PointToPoint
    destination:/topic/my-topic
    timestamp:1352999626186
    expires:0
    subscription:sub-0
    priority:4

    <PointToPoint xmlns="Message" ><SourceId>u_23</SourceId><TargetId>u_75</TargetId></PointToPoint>"

apollo

    "MESSAGE
    subscription:sub-0
    destination:
    content-length:331
    content-type:protocol/openwire
    message-id:xps-broker-291

    Eç{#ID:myID-61463-1352999939140-0:0emy-topicn{#ID:myID-61463-1352999939140-0:0; Å??<PointToPoint xmlns="Message" ><SourceId>u_23</SourceId><TargetId>u_75</TargetId></PointToPoint>(class Message.PointToPoint
"

Do you think it could be a problem in Apollo ?

解决方案

ActiveMQ 5.6 handles translating the logical OpenWire messages into a text representation for STOMP clients. Apollo, currently does not support that feature yet! :( See:

https://issues.apache.org/jira/browse/APLO-267

It just takes the full openwire message and uses it as the body of the STOMP message. BTW using binary data in a STOMP message is totally valid as long as the content-length header is properly set.

这篇关于ActiveMQ 到 Apollo 的转换,Openwire 到 Stomp 的协议配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆