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

问题描述

我正在尝试使用轮询消费者创建持久订阅者.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();
    }
}

推荐答案

Camel JmsPollingConsumer 基于 Spring JMSTemplate,不支持设置持久订阅选项.

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

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

08-15 07:01