Skip to content

Commit 7871578

Browse files
committed
amqp: Implement removeBinding()
1 parent 938ea3f commit 7871578

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/amqp.coffee

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ class MessageBroker extends Client
197197
return callback err
198198

199199
addBinding: (binding, callback) ->
200-
# TODO: support roundrobin type
201200
debug 'Broker.addBinding', binding
202201
if binding.type == 'pubsub'
203202
@channel.bindQueue binding.tgt, binding.src, '', {}, callback
@@ -234,9 +233,18 @@ class MessageBroker extends Client
234233
else
235234
return callback new Error 'Unsupported binding type: '+binding.type
236235

237-
removeBinding: (binding, callback) -> # FIXME: implement
238-
return callback null
236+
removeBinding: (binding, callback) ->
237+
debug 'Broker.removeBinding', binding
238+
if binding.type == 'pubsub'
239+
@channel.unbindQueue binding.tgt, binding.src, '', {}, callback
240+
else if binding.type == 'roundrobin'
241+
return callback new Error "removeBinding() not supported for type='roundrobin'" # TODO:
242+
else
243+
return callback new Error "Unsupported binding type: #{binding.type}"
244+
245+
239246
listBindings: (from, callback) -> # FIXME: implement
247+
# NOTE: probably need to use the RabbitMQ HTTP API for this
240248
return callback null, []
241249

242250
# Data subscriptions

0 commit comments

Comments
 (0)