1
votes

I'm using Stomp messaging and am subscribed to a topic in my client/browser code:

stompClient.subscribe('/topic/informer', function(greeting){
                showGreeting(JSON.parse(greeting.body).content);
});

I am using a camel route that sends a message to an activemq topic:

I have tried both:

<to uri="activemq:topic:informer"/>

and:

<to uri="stomp:topic:informer"/>

Both simply create a topic in activemq and enqueue the messages there. They never reach the client. To me, this means that the /topic/informer in the client is separate from the topic:informer that I can see in the activemq console. Does anyone know how to link them either by making the subscription to the activemq topic or by changing the camel route to send to the topic referenced by the subscription?

Thank you so much in advance for any tips/advice!

2
Can you share the complete camel route configuration? Are you giving the correct broker URI? - Buchi
Any luck looking into the above issue? - lsiu

2 Answers

1
votes

Is your STOMP client connect and subscribed before the message is sent? Topics are not Queues, they don't hold onto sent messages if there is no client subscribed at the time of a send. If you client connects after the message is sent then it will not receive anything unless it is using a durable topic subscription which was created previously.

0
votes

I have few questions apart from what @Tim has asked.

  1. Which STOMP client library are you using in your client/browser code? The way you specify the topic sometimes changes based on the client library that you are using. Please check client documentation.

  2. From the broker logs, can you see for which topic the subscriber is subscribing to?

  3. If you can see the ActiveMQ console, can you see if there is any other topic that's created with the word "informer" in it? If so, you can easily figure out what's going wrong.