【发布时间】:2020-12-03 15:31:43
【问题描述】:
用例:我正在使用 Apache camel 从 Spring Boot 应用程序向 IBM MQ 侦听器发送请求,在发送时我必须更改 MQ JMS 属性 JMS_IBM_Character_Set=UTF-8 但这些更改没有在 Listener 端反映
谁能帮助我如何使用 Apache Camel 更改 IBM MQ 的属性值
// 请求队列 - 一个方向
@Component
public class RequestRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:request").
setProperty("JMS_IBM_Character_Set", constant("true")).
to("jms:REQUEST.Q1?disableReplyTo=true")
.log("Received Body is ${body} and header info is ${headers} ");
}
}
//在一个请求-回复队列之下
@Component
public class RequestReplyRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:request-reply").setProperty("JMS_IBM_Character_Set", constant("true"))
.to("log:like-to-see-all?level=INFO&showAll=true&multiline=true")
.to("jms:REQUEST.Q1?ReplyTo=REPLY.Q1&exchangePattern=InOut")
.log("Request-reply Body is ${body} and header info is ${headers} ");
from("jms:REPLY.Q1")
.log("Received Body is ${body} and header info is ${headers} ");
}
}
【问题讨论】:
-
你想要 37 而不是 UTF-8 对吗?
-
您能否详细说明您如何知道它没有反映在 Listener 端?
-
我想使用 UTF-8
-
MyApp (Produce Q1) ---------------- >OtherApp(Q1 -Listener) MyApp(Q2 Listener)
-
JMS 默认是 UTF-8,我想你希望骆驼也发送 37,我在你的第一个问题中解释了这一点。
标签: spring spring-boot apache-camel ibm-mq mq