Sha256: 8b2d7dd756eb36a2f93846f031e6627f16f25b0cc50fd9e171151eb8dd831c00
Contents?: true
Size: 1020 Bytes
Versions: 9
Compression:
Stored size: 1020 Bytes
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 end end
Version data entries
9 entries across 9 versions & 1 rubygems