Class: Karafka::Pro::RecurringTasks::Dispatcher
- Inherits:
-
Object
- Object
- Karafka::Pro::RecurringTasks::Dispatcher
- Defined in:
- lib/karafka/pro/recurring_tasks/dispatcher.rb
Overview
Dispatches appropriate recurring tasks related messages to expected topics
Class Method Summary collapse
-
.command(name, task_id) ⇒ Object
Dispatches the command request.
-
.log(event) ⇒ Object
Dispatches the task execution log record.
-
.schedule ⇒ Object
Snapshots to Kafka current schedule state.
Class Method Details
.command(name, task_id) ⇒ Object
Dispatches the command request
26 27 28 29 30 31 32 |
# File 'lib/karafka/pro/recurring_tasks/dispatcher.rb', line 26 def command(name, task_id) produce( topics.schedules, "command:#{name}:#{task_id}", serializer.command(name, task_id) ) end |
.log(event) ⇒ Object
Dispatches the task execution log record
36 37 38 39 40 41 42 |
# File 'lib/karafka/pro/recurring_tasks/dispatcher.rb', line 36 def log(event) produce( topics.logs, event[:task].id, serializer.log(event) ) end |
.schedule ⇒ Object
Snapshots to Kafka current schedule state
13 14 15 16 17 18 19 |
# File 'lib/karafka/pro/recurring_tasks/dispatcher.rb', line 13 def schedule produce( topics.schedules, 'state:schedule', serializer.schedule(::Karafka::Pro::RecurringTasks.schedule) ) end |