Permalink
Browse files

Avoid opts.delete() to prevent issues during reconnect and wrapper ap…

…is that pass in options
  • Loading branch information...
tmm1 committed Dec 8, 2009
1 parent 0b8ea26 commit cd2184591422a86d13cd735df5d6a4a70a4825e2
Showing with 6 additions and 6 deletions.
  1. +2 −2 lib/mq/exchange.rb
  2. +4 −4 lib/mq/queue.rb
View
@@ -249,13 +249,13 @@ def publish data, opts = {}
out = []
out << Protocol::Basic::Publish.new({ :exchange => name,
- :routing_key => opts.delete(:key) || @key }.merge(opts))
+ :routing_key => opts[:key] || @key }.merge(opts))
data = data.to_s
out << Protocol::Header.new(Protocol::Basic,
data.length, { :content_type => 'application/octet-stream',
- :delivery_mode => (opts.delete(:persistent) ? 2 : 1),
+ :delivery_mode => (opts[:persistent] ? 2 : 1),
:priority => 0 }.merge(opts))
out << Frame::Body.new(data)
View
@@ -113,7 +113,7 @@ def bind exchange, opts = {}
@mq.callback{
@mq.send Protocol::Queue::Bind.new({ :queue => name,
:exchange => exchange,
- :routing_key => opts.delete(:key),
+ :routing_key => opts[:key],
:nowait => true }.merge(opts))
}
self
@@ -140,7 +140,7 @@ def unbind exchange, opts = {}
@mq.callback{
@mq.send Protocol::Queue::Unbind.new({ :queue => name,
:exchange => exchange,
- :routing_key => opts.delete(:key),
+ :routing_key => opts[:key],
:nowait => true }.merge(opts))
}
self
@@ -250,7 +250,7 @@ def pop opts = {}, &blk
q.push(self)
@mq.send Protocol::Basic::Get.new({ :queue => name,
:consumer_tag => name,
- :no_ack => !opts.delete(:ack),
+ :no_ack => !opts[:ack],
:nowait => true }.merge(opts))
}
}
@@ -318,7 +318,7 @@ def subscribe opts = {}, &blk
@mq.callback{
@mq.send Protocol::Basic::Consume.new({ :queue => name,
:consumer_tag => @consumer_tag,
- :no_ack => !opts.delete(:ack),
+ :no_ack => !opts[:ack],
:nowait => true }.merge(opts))
}
self

0 comments on commit cd21845

Please sign in to comment.