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
34 35 36 37 38 39 40 |
# File 'lib/karafka/pro/recurring_tasks/dispatcher.rb', line 34 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
44 45 46 47 48 49 50 |
# File 'lib/karafka/pro/recurring_tasks/dispatcher.rb', line 44 def log(event) produce( topics.logs, event[:task].id, serializer.log(event) ) end |
.schedule ⇒ Object
Snapshots to Kafka current schedule state
21 22 23 24 25 26 27 |
# File 'lib/karafka/pro/recurring_tasks/dispatcher.rb', line 21 def schedule produce( topics.schedules, 'state:schedule', serializer.schedule(::Karafka::Pro::RecurringTasks.schedule) ) end |