Sha256: 28c89b0feb47c4a6c819f9b7e85af22e822bdf53890e2252389a2b7e8446ac3c
Contents?: true
Size: 965 Bytes
Versions: 7
Compression:
Stored size: 965 Bytes
Contents
module Larva class Processor def self.process(message) new(message).process_with_logging end attr_accessor :message, :action, :entity, :id def initialize(raw_message) @message = HashWithIndifferentAccess.new(raw_message) @action = message[:action] @entity = message[:entity] @id = message[:id] end def process_with_logging Propono.config.logger.info "Processing message: #{message}" meta_process || normal_process end private def meta_process meta_method = "#{entity}_#{action}" if respond_to? meta_method self.send(meta_method) true else false end end def normal_process if respond_to?(:process) && self.process Propono.config.logger.info "Message Processed: #{message}" else Propono.config.logger.info "Unrecognized event type, entity: #{entity} action: #{action}." end end end end
Version data entries
7 entries across 7 versions & 1 rubygems