Class: Twingly::AMQP::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/twingly/amqp/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(delivery_info:, metadata:, payload:, channel:) ⇒ Message

Returns a new instance of Message.



6
7
8
9
10
11
# File 'lib/twingly/amqp/message.rb', line 6

def initialize(delivery_info:, metadata:, payload:, channel:)
  @delivery_info = delivery_info
        = 
  @payload       = parse_payload(payload)
  @channel       = channel
end

Instance Attribute Details

#delivery_infoObject (readonly)

Returns the value of attribute delivery_info.



4
5
6
# File 'lib/twingly/amqp/message.rb', line 4

def delivery_info
  @delivery_info
end

#metadataObject (readonly)

Returns the value of attribute metadata.



4
5
6
# File 'lib/twingly/amqp/message.rb', line 4

def 
  
end

#payloadObject (readonly)

Returns the value of attribute payload.



4
5
6
# File 'lib/twingly/amqp/message.rb', line 4

def payload
  @payload
end

Instance Method Details

#ackObject



13
14
15
# File 'lib/twingly/amqp/message.rb', line 13

def ack
  @channel.ack(@delivery_info.delivery_tag)
end

#rejectObject



21
22
23
# File 'lib/twingly/amqp/message.rb', line 21

def reject
  @channel.reject(@delivery_info.delivery_tag, false)
end

#requeueObject



17
18
19
# File 'lib/twingly/amqp/message.rb', line 17

def requeue
  @channel.reject(@delivery_info.delivery_tag, true)
end