Class: HotBunnies::ReactiveMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/euston-rabbitmq/hot_bunnies/reactive_message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject (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

#headersObject (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

Returns:

  • (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