我正在尝试升级其中一个应用程序的驼峰版本。但似乎我不能再使用“transferExchange”选项在ActiveMQ / JMS上发送属性。
我写了一个小测试程序:
public static void main(String args[]) throws Exception {
CamelContext context = new DefaultCamelContext();
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
context.addComponent("test-jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
String JMS_URI = "test-jms:queue:test.queue?transferExchange=true";
from("direct:start")
.setProperty("some-string", constant("foo"))
.setProperty("some-date", body())
.to(JMS_URI);
from(JMS_URI)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println("some-string: " + exchange.getProperty("some-string"));
System.out.println("some-date: " + exchange.getProperty("some-date"));
}
});
}
});
ProducerTemplate template = context.createProducerTemplate();
context.start();
template.sendBody("direct:start", new Date());
Thread.sleep(1000);
context.stop();
}
使用Camel 2.15.2时输出正确的值,但使用2.18.3时输出正确值。
我怎样才能得到旧的行为?
答案 0 :(得分:2)
Exchange属性不再传播,您无法启用它。将您的数据存储在邮件标题中。