Class: EventHub::Adapters::Test::Message

Inherits:
Message
  • Object
show all
Defined in:
lib/event_hub/adapters/test/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Message

#headers, #routing_key

Constructor Details

#initialize(event, queue, attributes = {}) ⇒ Message

Returns a new instance of Message.



7
8
9
10
11
12
# File 'lib/event_hub/adapters/test/message.rb', line 7

def initialize(event, queue, attributes = {})
  @event = event
  @body = event.body
  @attributes = attributes
  @queue = queue
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



14
15
16
# File 'lib/event_hub/adapters/test/message.rb', line 14

def attributes
  @attributes
end

#bodyObject (readonly)

Returns the value of attribute body.



14
15
16
# File 'lib/event_hub/adapters/test/message.rb', line 14

def body
  @body
end

Instance Method Details

#ackObject



24
25
26
27
# File 'lib/event_hub/adapters/test/message.rb', line 24

def ack
  @ack = true
  @queue.delete(self)
end

#ack?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/event_hub/adapters/test/message.rb', line 34

def ack?
  !!@ack
end

#eventObject



16
17
18
# File 'lib/event_hub/adapters/test/message.rb', line 16

def event
  @event.class.event
end

#rejectObject



29
30
31
32
# File 'lib/event_hub/adapters/test/message.rb', line 29

def reject
  @rejected = true
  @queue.delete(self)
end

#rejected?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/event_hub/adapters/test/message.rb', line 38

def rejected?
  !!@rejected
end

#versionObject



20
21
22
# File 'lib/event_hub/adapters/test/message.rb', line 20

def version
  @event.class.version
end