-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
passive option not working in queue function #55
Comments
Anyone have any ideas on how to fix this? |
My understanding from the Readme was that the passive option allowed one to check to see if the queue exists, not create it if it does not exists. From the readme, "The client can use this to check whether a queue exists without modifying the server state". When I did some testing, I created the queue if I did not get one using the passive: true option; and that seemed to work. |
Anyone actually solving this? |
It worked fine for me. The passive option just checks to see if the queue already exists; it will not create the queue. I used something like the following: function createQueue (conn,qname,opts,cb){
if ( _.isFunction(opts)){
cb = opts;
opts = {};
}
var f = Futures.future({error: function(){}});
f.when(function(){
cb.apply(cb,arguments);
});
var ncb = f.fulfill;
var me = this;
var q = conn.queue(qname, {passive: true}, function(queue){
ncb(false,queue);
}).on('error', function(){
doCreateQueue(conn,qname,opts,ncb);
})
}
function doCreateQueue(conn,qname,opts,cb){
conn.queue(qname,opts,function(queue){
cb,(false,queue);
}).on('error',function(err){
cb(err,null);
});
} To be fair, I forked this project and made some modifications, but I do not think any of them changed this behavior. |
I am opening my queue like this:
var q = connection.queue('MyQueue, {passive: true},function(queue) { console.log("Queue " + queue.name + " is open");});
Whether I set passive to true or false I get the error:
Error: NOT_FOUND - no queue 'MyQueue' in vhost '/'
It is my understanding from the readme that if I set the passive to true the queue will be created if it does not exist. But this does not seem to be the case.
The text was updated successfully, but these errors were encountered: