Class: RabbitMQClient::ReactiveMessage
- Inherits:
-
Object
- Object
- RabbitMQClient::ReactiveMessage
- Defined in:
- lib/jessica/rabbitmq_client.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#envelope ⇒ Object
readonly
Returns the value of attribute envelope.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
- #ack!(multiple = false) ⇒ Object
-
#initialize(channel, delivery, body = nil) ⇒ ReactiveMessage
constructor
A new instance of ReactiveMessage.
- #reject!(requeue = true) ⇒ Object
- #should_acknowledge? ⇒ Boolean
Constructor Details
#initialize(channel, delivery, body = nil) ⇒ ReactiveMessage
Returns a new instance of ReactiveMessage.
192 193 194 195 196 197 198 |
# File 'lib/jessica/rabbitmq_client.rb', line 192 def initialize(channel,delivery,body = nil) @channel,@delivery = channel,delivery @body = body || delivery.body @envelope = delivery.envelope @properties = delivery.properties @reacted = false end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
191 192 193 |
# File 'lib/jessica/rabbitmq_client.rb', line 191 def body @body end |
#envelope ⇒ Object (readonly)
Returns the value of attribute envelope.
191 192 193 |
# File 'lib/jessica/rabbitmq_client.rb', line 191 def envelope @envelope end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
191 192 193 |
# File 'lib/jessica/rabbitmq_client.rb', line 191 def properties @properties end |
Instance Method Details
#ack!(multiple = false) ⇒ Object
199 200 201 202 |
# File 'lib/jessica/rabbitmq_client.rb', line 199 def ack!(multiple=false) @channel.basic_ack(@envelope.delivery_tag, multiple) @reacted = true end |
#reject!(requeue = true) ⇒ Object
203 204 205 206 |
# File 'lib/jessica/rabbitmq_client.rb', line 203 def reject!(requeue = true) @channel.basic_reject(@envelope.delivery_tag, requeue) @reacted = true end |
#should_acknowledge? ⇒ Boolean
207 208 209 |
# File 'lib/jessica/rabbitmq_client.rb', line 207 def should_acknowledge? !@reacted end |