Class: RabbitMQClient::QueueConsumer
- Inherits:
-
DefaultConsumer
- Object
- DefaultConsumer
- RabbitMQClient::QueueConsumer
- Defined in:
- lib/jessica/rabbitmq_client.rb
Instance Method Summary collapse
- #handleDelivery(consumer_tag, envelope, properties, body) ⇒ Object
-
#initialize(channel, block) ⇒ QueueConsumer
constructor
A new instance of QueueConsumer.
Constructor Details
#initialize(channel, block) ⇒ QueueConsumer
Returns a new instance of QueueConsumer.
55 56 57 58 59 |
# File 'lib/jessica/rabbitmq_client.rb', line 55 def initialize(channel, block) @channel = channel @block = block super(channel) end |
Instance Method Details
#handleDelivery(consumer_tag, envelope, properties, body) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/jessica/rabbitmq_client.rb', line 61 def handleDelivery(consumer_tag, envelope, properties, body) delivery_tag = envelope.get_delivery_tag = String.from_java_bytes(body) # TODO: Do we need to do something with properties? case @block.arity when 1 @block.call when 2 @block.call , properties when 3 @block.call , properties, envelope end @channel.basic_ack(delivery_tag, false) end |