Sha256: bca1146d7c2409424606c416ad4fc78e7f9758364c03194ae4d91979f62506d6
Contents?: true
Size: 926 Bytes
Versions: 16
Compression:
Stored size: 926 Bytes
Contents
module Larva class Processor def self.process(message) new(message).process_with_logging end attr_accessor :message, :action, :entity, :id def initialize(message) @message = 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
16 entries across 16 versions & 1 rubygems