Barea Ye
Barea Ye

Reputation: 1

Get queue size using Rabbitmq STOMP websocket

I want to build a message queue system and I am trying to build a client through RabbitMQ STOMP web-socket which can not only send message to a queue but also can know the size of the queue it is sending to. How can I get the queue size from the client side?

Here is the code I got (JavaScript part):

<script>
    var ws = new WebSocket('ws://127.0.0.1:15674/ws');
    var client = Stomp.over(ws);

    var on_connect = function() {

    };
    var on_error =  function() {
        alert("error");
    };

    client.connect('guest', 'guest', on_connect, on_error);

    function sendMessage(){
        var text = $('#first form input').val();
        client.send('/queue/test', null, text);
    }

</script>

Upvotes: 0

Views: 499

Answers (1)

Ydrus
Ydrus

Reputation: 11

Thing you're looking for is basic.get method. This method provides a direct access to the messages in a queue using a synchronous dialogue that is designed for specific types of application where synchronous functionality is more important than performance.

http://www.rabbitmq.com/amqp-0-9-1-quickref.html

Upvotes: 0

Related Questions