Class: HotBunnies::ReactiveMessage
- Inherits:
-
Object
- Object
- HotBunnies::ReactiveMessage
- Defined in:
- lib/euston-rabbitmq/hot_bunnies/reactive_message.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
- #ack(opts = {}) ⇒ Object
-
#initialize(channel, headers, body) ⇒ ReactiveMessage
constructor
A new instance of ReactiveMessage.
- #reacted? ⇒ Boolean
- #reject(opts = {}) ⇒ Object
Constructor Details
#initialize(channel, headers, body) ⇒ ReactiveMessage
Returns a new instance of ReactiveMessage.
5 6 7 8 9 10 |
# File 'lib/euston-rabbitmq/hot_bunnies/reactive_message.rb', line 5 def initialize channel, headers, body @channel = channel @headers = headers @body = body @reacted = false end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/euston-rabbitmq/hot_bunnies/reactive_message.rb', line 3 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
3 4 5 |
# File 'lib/euston-rabbitmq/hot_bunnies/reactive_message.rb', line 3 def headers @headers end |
Instance Method Details
#ack(opts = {}) ⇒ Object
12 13 14 15 |
# File 'lib/euston-rabbitmq/hot_bunnies/reactive_message.rb', line 12 def ack opts = {} @headers.ack({ :multiple => false }.merge(opts)) @reacted = true end |
#reacted? ⇒ Boolean
22 23 24 |
# File 'lib/euston-rabbitmq/hot_bunnies/reactive_message.rb', line 22 def reacted? @reacted end |
#reject(opts = {}) ⇒ Object
17 18 19 20 |
# File 'lib/euston-rabbitmq/hot_bunnies/reactive_message.rb', line 17 def reject opts = {} @headers.reject({ :requeue => true }.merge(opts)) @reacted = true end |