amqp-as-promised
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -78,17 +78,29 @@ // Generated by CoffeeScript 1.6.3 | ||
var def; | ||
if (conf.local) { | ||
throw new Error('Unable to connect queue when conf.local = true'); | ||
} | ||
if (isShutdown) { | ||
throw new Error('Unable to connect queue shutdown'); | ||
} | ||
def = Q.defer(); | ||
conn.then(function(mq) { | ||
var prom; | ||
prom = mq._ttQueues[qname]; | ||
if (prom) { | ||
return prom.then(function(q) { | ||
return def.resolve(q); | ||
}); | ||
if (qname !== "") { | ||
prom = mq._ttQueues[qname]; | ||
if (prom) { | ||
return prom.then(function(q) { | ||
return def.resolve(q); | ||
}); | ||
} | ||
if (qname) { | ||
mq._ttQueues[qname] = def.promise; | ||
} | ||
} | ||
if (qname) { | ||
mq._ttQueues[qname] = def.promise; | ||
} | ||
opts = opts != null ? opts : { | ||
durable: true, | ||
autoDelete: qname === "" | ||
}; | ||
return mq.queue(qname, opts, function(queue) { | ||
log.info('queue created:', queue.name); | ||
if (!qname) { | ||
if (qname === "") { | ||
mq._ttQueues[queue.name] = def.promise; | ||
@@ -119,8 +131,3 @@ } | ||
(unbind(qname)).then(function() { | ||
var opts; | ||
opts = { | ||
durable: true | ||
}; | ||
opts.autoDelete = qname === ""; | ||
return Q.all([exchange(exname), queue(qname, opts)]); | ||
return Q.all([exchange(exname), queue(qname)]); | ||
}).spread(function(ex, q) { | ||
@@ -221,2 +228,3 @@ log.info('binding:', exname, q.name, topic); | ||
exchange: exchange, | ||
queue: queue, | ||
bind: bind, | ||
@@ -223,0 +231,0 @@ shutdown: shutdown, |
{ | ||
"name": "amqp-as-promised", | ||
"description": "Promise wrappers for node-amqp", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -34,3 +34,2 @@ AMQP as Promised | ||
## Using `amqpc` to publish | ||
@@ -48,2 +47,7 @@ | ||
## Using `amqpc` to create an anonymous queue | ||
amqpc.queue('').then (q) -> | ||
console.log 'queue created: ' + q.name | ||
## Shutting down | ||
@@ -50,0 +54,0 @@ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
14440
228
60
0