Apache Camel - IBM MQ 集成 [英] Apache Camel - IBM MQ integration
问题描述
我有一个 Apache camel(版本 2.18)项目,它通过 IBM MQ 客户端将文件发送到我合作伙伴的 IBM MQ 服务器.但是,我的伙伴使用 messageId
作为文件名,因此,我们必须将特定文件名设置为 messageId
.
I have a Apache camel (version 2.18) project that sends a file to my partner's IBM MQ server by IBM MQ client. However, my partner uses the messageId
as the filename, thus, we have to set specific filename tomessageId
.
我的问题是我们如何更改 messageId
?
My question is how we can change the messageId
?
在将文件发送到 IBM MQ 服务器之前,我尝试添加 JMS_IBM_MQMD_MsgId
或 MsgId
或修改 JMS 标头中的 JMSMessageId
,但是它不起作用.你有什么解决办法吗?
I tried to add JMS_IBM_MQMD_MsgId
or MsgId
or modify the JMSMessageId
in JMS header before I send the file to the IBM MQ server, but it doesn't work.
Do you have any solution?
这是spring文件中的代码.例如,在我们将 JMS 发送到我伙伴的服务器之前.我们将以下键/值设置为 JMS 标头:
Here is the code in spring file. For example, before we send JMS to my partner's server. We set the below key/value to JMS header:
exchange.getIn().setHeader("JMS_IBM_MQMD_MsgId",MsgExtFileName().getBytes())
exchange.getIn().setHeader("JMS_IBM_Format", MQC.MQFMT_STRING)
推荐答案
我们面临同样的问题:我们必须通过某种规则生成 ID 并将其设置为 MQMD MsgID.此代码执行此操作:
We are faced with the same problem: we have to generate ID by some rule and set it to MQMD MsgID. This code do this:
exchange.getIn().setHeader("CamelJmsDestinationName", "queue:///QueueName?mdWriteEnabled=true");
exchange.getIn().setHeader("JMS_IBM_MQMD_MsgId", "123456789012345678901234".getBytes());
这篇关于Apache Camel - IBM MQ 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!