Search code examples
spring-bootgradleapache-cameljms-topicsolace

Solace: Unknown Durable Topic Endpoint


I am trying to create durable endpoints. I am using solace-jms-spring-boot-starter.

How I tried:

amqp:topic:testTopic?clientId=1&durableSubscriptionName=Test&subscriptionDurable=true

OR

@Autowired
private JmsTemplate jmsTemplate;
final ConnectionFactory connectionFactory1 = jmsTemplate.getConnectionFactory();
final Connection connection1 = connectionFactory1.createConnection();
final int sessionAcknowledgeMode = jmsTemplate.getSessionAcknowledgeMode();
Session session = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
final Topic topic = session.createTopic(testTopic);
session.createDurableSubscriber(topic,"Test","",true);

The topic is not create, I cannot see it in SolAdmin. Then I created manually the durable topic "testTopic". But I cannot create the subscriber. I have the following error:

org.apache.camel.spring.boot.CamelSpringBootInitializationException: javax.jms.JMSSecurityException: Error creating consumer - unknown endpoint (503: Unknown Durable Topic Endpoint)
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:133) ~[camel-spring-boot-2.20.2.jar:2.20.2]
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:57) ~[camel-spring-boot-2.20.2.jar:2.20.2]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
...
Caused by: com.solacesystems.jcsmp.JCSMPErrorResponseException: 503: Unknown Durable Topic Endpoint
at com.solacesystems.jcsmp.impl.flow.BindRequestTask.execute(BindRequestTask.java:161) ~[sol-jms-10.5.0.jar:na]
at com.solacesystems.jcsmp.impl.flow.SubFlowManagerImpl.handleAssuredCtrlMessage(SubFlowManagerImpl.java:534) ~[sol-jms-10.5.0.jar:na]
at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.handleAssuredCtrlMsg(TcpClientChannel.java:1640) ~[sol-jms-10.5.0.jar:na]
at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.handleMessage(TcpClientChannel.java:1608) ~[sol-jms-10.5.0.jar:na]
at com.solacesystems.jcsmp.protocol.nio.impl.SubscriberMessageReader.processRead(SubscriberMessageReader.java:98) ~[sol-jms-10.5.0.jar:na]

A non-durable endpoint is created with no problem. I have implemented some JUnits to test the durable endpoints. ( all of the were successful). The difference was that I am creating my connectionFactory:

JmsConnectionFactory connectionFactory = new JmsConnectionFactory(username, password, url);

AMQPComponent amqp = new AMQPComponent();
amqp.setConnectionFactory(connectionFactory);
context.addComponent("amqp", amqp);

I don't get it. What am I missing? If this a security problem (like I don't have permissions, why I can create durable topics from my Junits?)


Solution

  • It looks like the topic that you are subscribing to is "testTopic", but the name of the Durable Topic Endpoint that the client is binding to is "Test". It is required to provision this Durable Topic Endpoint named Test on the Solace PubSub+ message broker in order for the client to bind to it. After it is provisioned, the topic subscription "testTopic" will be applied to the endpoint when the clients binds to it and the client will receive all messages that are published to this topic.

    More information on provisioning a Durable Topic Endpoint is available here: https://docs.solace.com/Configuring-and-Managing/Configuring-DTEs.htm

    A Non-durable Topic Endpoint is different from a Durable Topic Endpoint in that it is dynamically created by client applications and only persists on the message broker while the client's session is connected. This is why you are able to create a Non-durable Topic Endpoint with no problem.