Sha256: dd716e5341fc7be9ff409524df6cbcb92c932a8e462ad5ef9e4e809e9ecb9f52
Contents?: true
Size: 846 Bytes
Versions: 2
Compression:
Stored size: 846 Bytes
Contents
class Mercury class ReceivedMessage attr_reader :content, :metadata, :action_taken def initialize(content, metadata, is_ackable: false) @content = content @metadata = metadata @is_ackable = is_ackable end def tag metadata.routing_key end def headers metadata.headers || {} end def ack performing_action(:ack) metadata.ack end def reject performing_action(:reject) metadata.reject(requeue: false) end def nack performing_action(:nack) metadata.reject(requeue: true) end private def performing_action(action) @is_ackable or raise "This message is not #{action}able" if @action_taken raise "This message was already #{@action_taken}ed" end @action_taken = action end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mercury_amqp-0.4.0 | lib/mercury/received_message.rb |
mercury_amqp-0.3.0 | lib/mercury/received_message.rb |