def bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)
nowait = true unless block
exchange_name = if exchange.respond_to?(:name)
exchange.name
else
exchange
end
@connection.send_frame(Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))
if !nowait
self.append_callback(:bind, &block)
@channel.queues_awaiting_bind_ok.push(self)
end
binding = { :exchange => exchange_name, :routing_key => routing_key, :arguments => arguments }
@bindings.push(binding) unless @bindings.include?(binding)
self
end