Gold100 Gold100 - 1 year ago 124
Javascript Question

Problems with RabbitMQ and web-stomp

I'm using RabbitMQ and web-stomp in the web browser according to this tutorial:

I succeded to connect and the get messages in the browser.


  1. the message I sent and consumed in the client is still in the queue and not being dequeing(I did manual ack and auto ack), it still exists.

  2. when I subscribe to a queue I'm not getting all the messages in the queue, but only the last.. only when the websocket is open and then the server send the message i get the last message but not the old ones.

The server Code:

private static final String EXCHANGE_NAME = "amq.topic";

public static void AddToQueue(String RoutingKey, String message) throws IOException, TimeoutException {
ConnectionFactory factory = new ConnectionFactory();
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();

channel.exchangeDeclare(EXCHANGE_NAME, "topic");

channel.basicPublish(EXCHANGE_NAME, RoutingKey, null, message.getBytes());


The client code:

var ws = new SockJS('http://' + window.location.hostname + ':15674/stomp');
$scope.client = Stomp.over(ws);
$scope.client.heartbeat.outgoing = 0;
$scope.client.heartbeat.incoming = 0;
var on_connect = function(x) {
$scope.client.subscribe("/topic/status", function(d) {
var on_error = function() {
$scope.client.connect('guest', 'guest', on_connect, on_error, '/');


Answer Source

Solved it, the exchange name needs to be "amq.topic"

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download