Sha256: 24e60ef13d2d550ab6282ddfc2c0b430231bb1d10f9b442a99f2cf86feae8996
Contents?: true
Size: 1.24 KB
Versions: 16
Compression:
Stored size: 1.24 KB
Contents
module Msgr class Message attr_reader :delivery_info, :metadata, :payload, :route def initialize(connection, delivery_info, metadata, payload, route) @connection = connection @delivery_info = delivery_info @metadata = metadata @payload = payload @route = route if content_type == 'application/json' @payload = MultiJson.load(payload) @payload.symbolize_keys! if @payload.respond_to? :symbolize_keys! end end def content_type @metadata.content_type end # Check if message is already acknowledged. # # @return [Boolean] True if message is acknowledged, false otherwise. # @api public # def acked? @acked ? true : false end # Send message acknowledge to broker unless message is # already acknowledged. # # @api public # def ack unless acked? @acked = true @connection.ack delivery_info.delivery_tag end end # Send negative message acknowledge to broker unless # message is already acknowledged. # # @api public # def nack unless acked? @acked = true @connection.nack delivery_info.delivery_tag end end end end
Version data entries
16 entries across 16 versions & 1 rubygems