class Optimizely::ForwardingEventProcessor
Public Class Methods
new(event_dispatcher, logger = nil, notification_center = nil)
click to toggle source
ForwardingEventProcessor
is a basic transformation stage for converting the event batch into a LogEvent to be dispatched.
# File lib/optimizely/event/forwarding_event_processor.rb, line 23 def initialize(event_dispatcher, logger = nil, notification_center = nil) @event_dispatcher = event_dispatcher @logger = logger || NoOpLogger.new @notification_center = notification_center end
Public Instance Methods
process(user_event)
click to toggle source
# File lib/optimizely/event/forwarding_event_processor.rb, line 29 def process(user_event) log_event = Optimizely::EventFactory.create_log_event(user_event, @logger) begin @event_dispatcher.dispatch_event(log_event) @notification_center&.send_notifications( NotificationCenter::NOTIFICATION_TYPES[:LOG_EVENT], log_event ) rescue StandardError => e @logger.log(Logger::ERROR, "Error dispatching event: #{log_event} #{e.message}.") end end