JMS 传输与 MQ 传输
我使用 Oracle Service Bus(OSB) 作为 MOM,目标 URI 是 IBM MQ 队列。我只是想知道哪种交通是首选。 OSB 为同一个适配器提供了 2 个适配器:JMS 适配器和用于传输的 MQ 适配器。有谁知道相同的优点和缺点是什么。 TIA
I am using Oracle Service Bus(OSB) as the MOM, and the destination URI is a IBM MQ queue. I just want to know which would be the preferred transport. OSB provides 2 adapters for the same, JMS adapter and MQ adapter for transport. Does any one knows what are the PROS and CONS of the same. TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
通常,通过本机 MQI 接口发送消息比使用 JMS 更快。实际上,我怀疑您是否会看到真正的差异,除非您每天发送大量消息。然而,除了速度之外,还有其他事情需要考虑。例如,如果您不熟悉 MQI 应用程序,那么学习曲线将比 JMS 更陡峭。
当通过 MQ 发送到另一个 JMS 目标时,JMS 标头信息会映射到 MQRFH2 标头。 MQRFH2 标头的包含是由您创建的 Destination 对象驱动的。如果目标是 JMS 端点,则包含标头。
我在下面添加了一个链接,解释了如何映射字段:
实际上,除非您每天发送数百万条消息,否则我认为 WebsphereMQ 上的 JMS 性能足以满足您的需求。至于请求回复中的线程阻塞,我认为您不需要担心这一点。默认情况下,WebsphereMQ 中的回复由单独的线程而不是请求线程使用。
Typically, sending messages via the native MQI interface will be faster than using JMS. In reality I doubt you will see a real difference, unless you are sending tons of messages per day. However, there are other things to consider than just speed. For example, if you are not familiar with MQI applications the learning curve will be steeper than JMS.
JMS header information is mapped to an MQRFH2 header when sent to another JMS destination via MQ. The inclusion of a MQRFH2 header is driven off of the Destination object you create. If the destination is a JMS endpoint then the header is included.
I have included a link below that explains how the fields are mapped:
In reality, unless you are sending millions of messages a day I would assume that the performance of JMS on WebsphereMQ will be more than adequate for your needs. As far as thread blocking goes in request reply I don't think you need to worry about this. By default the reply in WebsphereMQ is consumed by a seperate thread, not the requesting thread.
只是想添加我发现对我有用的内容。创建队列实例时,您必须执行以下操作。
包含“?targetClient=1”会导致发送带有 oa 标头的原始消息。
希望这对某人有帮助。标记
Just wanted to add what I found that worked for me. You have to do the following when you create your Queue instance.
The inclusion of the "?targetClient=1" causes the raw message to be sent w/o a header.
Hope this helps someone. Mark
这取决于 MQ 队列另一端的程序是否期望 JMS 或“本机”MQ 消息。
MQ 可以充当本机队列机制或 JMS 消息的传输。区别在于 JMS 消息在消息缓冲区的开头有一些标准标头字段,而“本机”mq 消息仅包含程序发送到缓冲区的数据。
It depends on whther the program at the other end of the MQ queue is expecting a JMS or "native" MQ message.
MQ can act as a native queue mechanism or a transport for JMS messages. The difference being that JMS messages have some standard header fields at the begining of the message buffer and "native" mq messages contain just the data your program sent to the buffer.
性能并不是从 JMS 客户端向 MQ 服务器发送不带 JMS 标头的纯消息(MQ 格式)的唯一原因。消息使用者也可能是非 JMS 客户端,例如 Tivoli Workload Scheduler (TWS) 和 .net。
我提出了一种针对 Java 独立客户端的解决方案和针对 jboss 的解决方案,从 JMS 消息中删除 MQRFH2 格式并将其转换为纯消息:
独立 JMS 客户端
应用程序服务器 JBoss 7 资源适配器< /强>
Performance is not the only reason to send plain messages (MQ format) without the JMS Headers from JMS Client to MQ Server. It can also be that the message consumer is a non JMS client, such as Tivoli Workload Scheduler (TWS) and .net.
I present a solution for a Java standalone client and one for jboss as that remove the MQRFH2 format from the JMS message and turn it into plain message:
Standalone JMS client
Application Server JBoss 7 resource adapter
根据丰富的个人经验,如果可能的话,我强烈建议使用 Native MQ。
JMS 传输缺点(使用 WMQ 时)-
唯一主要的专业 JMS 传输超过本机 MQ就是它对XA事务的支持。此问题已在 OSB 11.1.1.7 中得到解决,现在两种传输都支持 XA。
本机 MQ 优点 -
再次,我强烈建议使用 <尽可能使用 OSB 传输本机 MQ。
From an abundance of personal experience, I strongly recommend using Native MQ if possible.
JMS Transport cons (when using WMQ) -
The only major pro JMS Transport had over native MQ is its support of XA transaction. This has been resoled in OSB 11.1.1.7 and now both transports support XA.
Native MQ Pros -
Again, I strongly recommend use of Native MQ Transport in OSB whenever possible.
对于其他可能在这里查看的人来说,我的 2c 是截至 2017 年的一点更新视图:
更多信息请参见此处 选择API
自 v8 以来的一般声明是新应用程序应该使用 IBM MQ 类进行 JMS。当然,这并不意味着 selotape 提到的所有优点和缺点都无效。您仍然需要更多配置,开箱即用的性能可能会较差。实际上,有一个针对 v8 的 MP0E 文档,声称他们已将 Java JMS MQ 应用程序与 C++ MQI 应用程序进行了比较,根据情况,前者速度慢了 35%(所以如果您得到的是 50 与 900,那么您正在做有问题)
Just my 2c for everybody else that might be looking here, a bit updated view as of 2017:
More info here Choice of API
General statement since v8 is that new applications should use IBM MQ classes for JMS. This of course does not invalidate all the pros and cons mentioned by selotape. You still need some more configuration and performance may be inferior out of the box. Actually there is a MP0E document for v8 that claims that they've compared Java JMS MQ App with C++ MQI app and the former was up to 35% slower depending on scenario (so if you are getting 50 vs 900 you are doing something wrong)