Skip to content
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

Open
kevinlieb opened this issue Dec 8, 2011 · 4 comments
Open

passive option not working in queue function #55

kevinlieb opened this issue Dec 8, 2011 · 4 comments

Comments

@kevinlieb
Copy link

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.

@kevinlieb
Copy link
Author

Anyone have any ideas on how to fix this?

@esk525
Copy link

esk525 commented Jan 25, 2012

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.

@ilyail3
Copy link

ilyail3 commented Mar 10, 2012

Anyone actually solving this?
there's no way to catch this error, nothing I could think of, rendering passive completely useless

@esk525
Copy link

esk525 commented Mar 17, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants