GithubHelp home page GithubHelp logo

Comments (4)

kevinlieb avatar kevinlieb commented on August 17, 2024

Anyone have any ideas on how to fix this?

from node-amqp.

esk525 avatar esk525 commented on August 17, 2024

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.

from node-amqp.

ilyail3 avatar ilyail3 commented on August 17, 2024

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

from node-amqp.

esk525 avatar esk525 commented on August 17, 2024

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.

from node-amqp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.