本文介绍了在骆驼中使用Polling Consumer创建持久订户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用轮询使用者创建持久的订户。
URI是正确的,因为在骆驼路线中使用相同的uri并正确创建了持久订户。
由于某种原因,PollingConsumer无法创建持久订户,而是创建普通订户。

I am trying to create a durable subscriber using polling consumer.The URI is correct as same uri is working when used in camel route and durable subscriber is correctly created.For some reason PollingConsumer is not able to create durable subscriber and instead creates normal subscriber.

是否不可能使用轮询使用者来创建持久订户?

Is it not possible to create durable subscribers using polling consumer?

public class OutQWaitingProcesser implements Processor {

    @Override
    public void process(Exchange exchange) throws Exception {
        Endpoint endpoint = exchange.getContext().getEndpoint("jms:topic:response?clientId=5&durableSubscriptionName=abcd");
        PollingConsumer consumer = endpoint.createPollingConsumer();
        consumer.start();
        Exchange exchange2 = consumer.receive();
        String body = exchange2.getIn().getBody(String.class);
        exchange.getIn().setBody(body);
        consumer.stop();
    }
}


推荐答案

骆驼JmsPollingConsumer基于Spring JMSTemplate,它不支持设置耐用订阅选项。

Camel JmsPollingConsumer is based on Spring JMSTemplate which doesn't support to set the durableSubscription option.

这篇关于在骆驼中使用Polling Consumer创建持久订户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 08:17