easternbloc / node-stomp-client

A STOMP client for Node.js
Other
93 stars 47 forks source link

Connecting to existing queue #53

Open zeeshanjan82 opened 9 years ago

zeeshanjan82 commented 9 years ago

I am using the following code which is mentioned in the ReadMe for subscribing and publishing to the RabbitMQ Queue:

var Stomp = require('stomp-client');
var destination = '/queue/someQueueName';
var client = new Stomp('127.0.0.1', 61613, 'user', 'pass');

client.connect(function(sessionId) {
    client.subscribe(destination, function(body, headers) {
      console.log('This is the body of a message on the subscribed queue:', body);
    });

    client.publish(destination, 'Oh herrow');
});

However each time I start my Node.JS service I see a new queue created with some random name like: stomp-subscription-dmAADeGXr6fWuOgLSo13zA I already have the queue created in RabbitMQ and I would like to connect to the same queue each time instead of creating a new queue always as the queue created is temporary and gets deleted when the NodeJS service stops. Is there any way to connect to a persistent queue.