# File lib/amqp/queue.rb, line 119 def bind(exchange, opts = {}, &block) @status = :unbound @sync_bind = ! opts[:nowait] exchange = exchange.respond_to?(:name) ? exchange.name : exchange @bindings[exchange] = opts @mq.callback { @mq.send Protocol::Queue::Bind.new({ :queue => name, :exchange => exchange, :routing_key => opts[:key], :nowait => block.nil? }.merge(opts)) } self.bind_callback = block block.call(self) if opts[:nowait] && block self end