Skip to content
Browse files

Update status

  • Loading branch information...
1 parent ff3537e commit 69983dfdca59e8f189d2a6410b7230c46b74b1c8 Jakub Šťastný aka Botanicus committed Nov 15, 2010
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/mq/exchange.rb
View
4 lib/mq/exchange.rb
@@ -204,7 +204,7 @@ def initialize mq, type, name, opts = {}, &block
@opts = { :exchange => name, :type => type, :nowait => block.nil? }.merge(opts)
@key = opts[:key]
@name = name unless name.empty?
- @status = @opts[:nowait] ? :unknown : :unfinished
+ @status = :unknown
# The AMQP 0.8 specification (as well as 0.9.1) in 1.1.4.2 mentiones
# that Exchange.Declare-Ok confirms the name of the exchange (because
@@ -217,12 +217,14 @@ def initialize mq, type, name, opts = {}, &block
# then RabbitMQ interpret it as if we'd try to redefine this default
# exchange so it'd produce an error.
unless name == "amq.#{type}" or name == '' or opts[:no_declare]
+ @status = :unfinished
@mq.callback {
@mq.send Protocol::Exchange::Declare.new(@opts)
}
else
# Call the callback immediately, as given exchange is already
# declared.
+ @status = :finished
block.call(self)
end

0 comments on commit 69983df

Please sign in to comment.
Something went wrong with that request. Please try again.