Changing AMQP to STOMP using Java to connect on RabbitMQ

371 views
Skip to first unread message

Raphael Lacerda

unread,
Jul 10, 2015, 2:27:26 PM7/10/15
to rabbitm...@googlegroups.com
I have an WebApp that uses SockJS with Stomp to connect with RabbitMQ.

The WebSocket and notifications using web browsers works fine!

However, when i use a JavaSE application to connect on Rabbit, it uses AMQP-0.9.1 (it's expected because it's the default protocol).


So, when i send a message using Java, the WebApp doesn't get the message.

Is there any way that a i can change the protocol that JavaSE application uses to connect on RabbitMQ
from AMQP to STOMP?


Michael Klishin

unread,
Jul 10, 2015, 2:36:22 PM7/10/15
to Raphael Lacerda, rabbitm...@googlegroups.com
You can use a STOMP client or make your Web app use STOMP destinations that interoperate with the standard RabbitMQ client (using the same change and/or queues).

MK
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raphael Lacerda

unread,
Jul 13, 2015, 2:28:10 PM7/13/15
to rabbitm...@googlegroups.com, lace...@gmail.com
Hi Klishin.

My Web app is already using STOMP, with JavaScript.

 

JavaScript Client

var ws = new SockJS('http://' + window.location.hostname+ ':15674/stomp');
var client = Stomp.over(ws);
   ...
   ...
   ... 
client.subscribe("/topic/notifications", ...


Nevertheless, using this way, it doesn't interoperate with Standard RabbitMQ topics

My Java App is just triyng to publish on the same topic, with a blank routingKey



Sender
channel.exchangeDeclare("notifications", "topic");
channel.basicPublish("notifications", "", null, message.getBytes("UTF-8"));
 
Receiver
channel.exchangeDeclare(EXCHANGE_NAME, "topic");
String queueName = channel.queueDeclare().getQueue();
channel.queueBind(queueName, EXCHANGE_NAME, "");



The JavaSE Receiver gets the message, however, the JavaScript Client is not being notified.


Michael, you said that i should use a STOMP destination that interoperates with RabbitMQ, do you have any example? 

Because i think that the way that i'm using with JavaScript, the STOMP topic destination is not the same as the Java Topic destination

Michael Klishin

unread,
Jul 13, 2015, 2:36:57 PM7/13/15
to Raphael Lacerda, rabbitm...@googlegroups.com
What is "standard topics"? Both STOMP plugins use topic exchange. What's needed for interop is making sure it's the same exchange (and thus vhost is the same).

MK

Иван Иванов

unread,
Aug 13, 2015, 1:40:15 AM8/13/15
to rabbitmq-users
i have the same problem. did you solve this somehow?

пятница, 10 июля 2015 г., 23:27:26 UTC+5 пользователь Raphael Lacerda написал:
Reply all
Reply to author
Forward
0 new messages