【问题标题】:ActiveMQ transferExchange no longer working in Camel?ActiveMQ transferExchange 不再在 Camel 中工作?
【发布时间】:2017-10-01 01:20:19
【问题描述】:

我正在尝试升级我们的一个应用程序的骆驼版本。但似乎我不能再使用“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 时为空。

我怎样才能得到旧的行为?

【问题讨论】:

    标签: apache-camel activemq


    【解决方案1】:

    Exchange 属性不再传播,您无法将其打开。将您的数据存储在邮件标题中。

    【讨论】:

      猜你喜欢
      • 2021-12-17
      • 2018-01-31
      • 2020-02-25
      • 2016-06-29
      • 2012-02-23
      • 2018-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多