使用Camel设置IBM MQ请求消息的MQMD的ReplyToQ属性 [英] setting ReplyToQ attribute of MQMD of IBM MQ request message with Camel

查看:375
本文介绍了使用Camel设置IBM MQ请求消息的MQMD的ReplyToQ属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Camel与Fuse一起使用,并且在设置JMSReplyTo时遇到了麻烦.这是我的路线的摘录:

I use Camel with Fuse, and I have trouble with setting JMSReplyTo. Here is an excerpt from my route:

<setHeader headerName="JMSReplyTo" id="_setHeader2">
    <constant>QTEST</constant>
</setHeader>
<setHeader headerName="CamelJmsDestinationName" id="_setHeader1">
    <constant>queue://QM_TEST/SYSTEM.DEFAULT.LOCAL.QUEUE?targetClient=1</constant>
</setHeader>
<to id="_to1" uri="websphere:queue:SYSTEM.DEFAULT.LOCAL.QUEUE?replyTo=QTEST"/>

我以此处给出的代码为例: 通过CoD在Camel上实现本地Websphere MQ JMS组件 起初,我认为这是因为我通过在CamelJmsDestinationName标头中设置了targetClient = 1指令删除了不需要的jms标头,但是即使没有它,它也不会为MQMD的ReplyToQ属性设置任何内容.我也尝试了这里给出的建议

I took as an example the code given here: Implementing native websphere MQ with CoD over Camel JMS component At first, I thought it is because I removed unwanted jms header with targetClient=1 directive set in CamelJmsDestinationName header, but even without it, it won't set anything to ReplyToQ attribute of MQMD. I tried the suggestion given here too How to send message to different Queue hosted in different queue manager and hostname in IBM MQ cluster, but this also doesn't work for me, that is like this:

queue://QM_TEST/QTEST?mdReadEnabled=true&messageBody=0&mdWriteEnabled=true&XMSC_WMQ_REPLYTO_STYLE=1&targetClient=1

问题是为什么它不起作用?

The question is why does it not work?

推荐答案

我已经弄清楚了如何设置ReplyToQ属性,但这只是我现在面临的问题的一部分.如此处所述,在"JMS生产者"一章中:

I have figured out how to set ReplyToQ attribute, but this is only a part of the problem that I'm facing now. As explained here, in JMS Producer chapter:

http://camel.apache.org/jms.html

所有需要的是这个

        <setHeader headerName="CamelJmsDestinationName" id="_setHeader1">
            <constant>queue://QMib_TEST/OUTPUTQ?targetClient=1</constant>
        </setHeader>
        <to id="_to1" uri="websphere:queue:SYSTEM.DEFAULT.LOCAL.QUEUE?replyTo=REPLYQ" pattern="InOut"/>

它的作用是将请求消息放入OUTPUTQ,然后侦听REPLYQ,但匹配一些自动生成的Correlation ID.好的事情是,由于pattern ="InOut"设置,现在请求消息中的ReplyToQ设置为REPLYQ,不好的是,在我们这种情况下,答复应用程序通过将Correlation ID设置为接收到的请求的Message ID来响应,所有这些都来自MQMD,并且默认情况下,此骆驼模式不会在请求的MQMD中生成等于其期望的(JMS?)相关ID的消息ID,因此即使将响应放入适当的队列中,该响应仍保留在队列中而不被使用.实际上,它甚至在经过获取的等待时间间隔后重复放置请求,从而产生了更多未在REPLYQ中使用的响应消息.因此,这是我要解决的另一个问题,如何正确处理MessageID和CorrelationID,但是我已经解决了这个问题.

What this does is it puts request message to OUTPUTQ, and then listens on REPLYQ, but with matching some autogenerated Correlation ID. Good thing is that ReplyToQ is now set to REPLYQ in a request message, due to pattern="InOut" setting, bad thing is that the in our case replying application responds with setting Correlation ID to Message ID of received request, all from MQMD, and this Camel pattern by default doesn't generate message id in MQMD of request equal to (JMS?) correlation ID that it expects, so that response remains in queue, not consumed, even though it was put in proper queue. In fact, it even repeats putting requests after a wait interval for get elapses, producing further reponse messages unconsumed in REPLYQ. So, that is another problem I have to solve, how to deal with MessageID and CorrelationID properly, but the one from the subject, I have solved.

这篇关于使用Camel设置IBM MQ请求消息的MQMD的ReplyToQ属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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