Class: Karafka::Pro::RecurringTasks::Listener

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/pro/recurring_tasks/listener.rb

Overview

Listener we use to track execution of recurring tasks and publish those events into the recurring tasks log table

Instance Method Summary collapse

Instance Method Details

#on_error_occurred(event) ⇒ Object

Note:

We do nothing with other errors. We only want to log and dispatch information about the recurring tasks errors. The general Web UI error tracking may also work but those are independent. It is not to replace the Web UI tracking but to just log failed executions in the same way as successful but just with the failure as an outcome.

Parameters:

  • event (Karafka::Core::Monitoring::Event)

    error that occurred



30
31
32
33
34
# File 'lib/karafka/pro/recurring_tasks/listener.rb', line 30

def on_error_occurred(event)
  return unless event[:type] == 'recurring_tasks.task.execute.error'

  Dispatcher.log(event)
end

#on_recurring_tasks_task_executed(event) ⇒ Object

Parameters:

  • event (Karafka::Core::Monitoring::Event)

    task execution event



21
22
23
# File 'lib/karafka/pro/recurring_tasks/listener.rb', line 21

def on_recurring_tasks_task_executed(event)
  Dispatcher.log(event)
end