Class: Karafka::Pro::RecurringTasks::Matcher
- Inherits:
-
Object
- Object
- Karafka::Pro::RecurringTasks::Matcher
- Defined in:
- lib/karafka/pro/recurring_tasks/matcher.rb
Overview
Matcher used to check if given command can be applied to a given task.
Instance Method Summary collapse
-
#matches?(task, payload) ⇒ Boolean
Is this message dedicated to current process and is actionable.
Instance Method Details
#matches?(task, payload) ⇒ Boolean
Returns is this message dedicated to current process and is actionable.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/karafka/pro/recurring_tasks/matcher.rb', line 22 def matches?(task, payload) # We only match commands return false unless payload[:type] == 'command' # * is a wildcard to match all for batch commands return false unless payload[:task][:id] == '*' || payload[:task][:id] == task.id # Ignore messages that have different schema. This can happen in the middle of # upgrades of the framework. We ignore this not to risk compatibility issues return false unless payload[:schema_version] == Serializer::SCHEMA_VERSION true end |