简体   繁体   English

如何使用Apache camel / Spring-boot订阅持久主题?

[英]How to subscribe to a Durable TOPIC using Apache camel / Spring-boot?

Whenever i start my subscriber, it is not appearing on my activeMQ under "Active Durable Topic Subscribers" section. 每当我启动我的订户时,它就不会出现在我的activeMQ的“活动持久主题订户”部分下。 Which means it is not a durable topic subscriber yet. 这意味着它还不是持久主题订阅者。 How can i make it durable subscriber? 我如何使其成为持久订阅者?

JmsComponent jmsComponent = JmsComponent
        .jmsComponentTransacted(connectionFactory, jmsTransactionManager);
// TODO
jmsComponent.setClientId(subscriptionClientId);
jmsComponent.setDurableSubscriptionName(subscriptionName);
jmsComponent.setSubscriptionDurable(true); // This is enabled by default
//jmsComponent.setMaxConcurrentConsumers(maxConcurrentConsumers);
jmsComponent.setAcknowledgementMode(Session.AUTO_ACKNOWLEDGE);

return jmsComponent;

PS: It works fine for Non-durable subscribers. PS:它对于非持久性订户很好用。 I added the below code in an attempt to make it durable. 我添加了以下代码,以使其持久。 Am i missing something ? 我想念什么吗? Do i need to add anything else? 我是否需要添加其他内容?

jmsComponent.setClientId(subscriptionClientId);
jmsComponent.setDurableSubscriptionName(subscriptionName);
jmsComponent.setSubscriptionDurable(true); // This is enabled by default

I got it working by passing the subscription details as query string param as below; 我通过将订阅详细信息作为查询字符串参数传递如下来使其工作:

myapp.jms.topic.inbound1=jms:topic:myFirstTopic?clientId=ABC&durableSubscriptionName=ABC myapp.jms.topic.inbound1 = JMS:主题:?myFirstTopic的clientId = ABC&durableSubscriptionName = ABC

myapp.jms.topic.inbound2=jms:topic:mysecondTopic?clientId=XYZ&durableSubscriptionName=XYZ myapp.jms.topic.inbound2 = JMS:主题:?mysecondTopic的clientId = XYZ&durableSubscriptionName = XYZ

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Apache骆驼和Spring-Boot构造函数注入-NPE - Apache camel and spring-boot constructor injection - NPE 结合使用Camel和Spring-boot来构建REST应用程序 - Using Camel with Spring-boot to build a REST Application 如何在 spring-boot 中运行集群的 camel-quartz 调度程序 - How to run clustered camel-quartz schedulers in spring-boot 如何订阅内部Spring Boot / Simple Broker主题队列? - How to subscribe an internal Spring Boot/Simple Broker topic queue? ProducerTemplate对于骆驼和spring-boot始终为null - ProducerTemplate is always null with camel and spring-boot Spring-Boot AMQP 1.3.1.RELEASE-持久队列 - Spring-Boot AMQP 1.3.1.RELEASE - Durable Queue 使用ActiveMQ创建持久的主题和订阅者spring boot jms - Create durable topic and subscriber spring boot jms with ActiveMQ Apache Camel — Hazelcast主题发布/订阅—如何在订户中序列化String消息 - Apache Camel — Hazelcast Topic Publish/Subscribe — how to serialize String message in Subscriber Apache Camel:如何创建 AWS SQS 并订阅 SNS 主题 - Apache Camel: How I can create AWS SQS and subscribe to SNS topic 使用 Apache Camel 和 Z38008DD81C2F4D1185ACF6E0CE8 调用 SOAP web 服务 - Call SOAP web services by using Apache Camel and Spring Boot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM