Method: Bunny::Queue#pop
- Defined in:
- lib/bunny/queue.rb
#pop(opts = {:manual_ack => false}, &block) ⇒ Array Also known as: get
Returns Triple of delivery info, message properties and message content. If the queue is empty, all three will be nils.
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/bunny/queue.rb', line 281 def pop(opts = {:manual_ack => false}, &block) unless opts[:ack].nil? warn "[DEPRECATION] `:ack` is deprecated. Please use `:manual_ack` instead." opts[:manual_ack] = opts[:ack] end get_response, properties, content = @channel.basic_get(@name, opts) if block if properties di = GetResponse.new(get_response, @channel) mp = MessageProperties.new(properties) block.call(di, mp, content) else block.call(nil, nil, nil) end else if properties di = GetResponse.new(get_response, @channel) mp = MessageProperties.new(properties) [di, mp, content] else [nil, nil, nil] end end end |