def declare(passive = false, durable = false, exclusive = false, auto_delete = false, nowait = false, arguments = nil, &block)
raise ArgumentError, "declaration with nowait does not make sense for server-named queues! Either specify name other than empty string or use #declare without nowait" if nowait && self.anonymous?
@passive = passive
@server_named = @name.empty?
@durable = durable
@exclusive = exclusive
@auto_delete = auto_delete
@arguments = arguments
nowait = true if !block && !@name.empty?
@connection.send_frame(Protocol::Queue::Declare.encode(@channel.id, @name, passive, durable, exclusive, auto_delete, nowait, arguments))
if !nowait
self.append_callback(:declare, &block)
@channel.queues_awaiting_declare_ok.push(self)
end
self
end