Module: Karafka::Pro::Routing::Features::ConsumerGroups::ScheduledMessages::Topic
- Defined in:
- lib/karafka/pro/routing/features/consumer_groups/scheduled_messages/topic.rb
Overview
Topic extensions to be able to check if given topic is a scheduled messages topic Please note, that this applies to both the schedules topic and logs topic
Instance Method Summary collapse
-
#initialize ⇒ Object
This method sets up the extra instance variable to nil before calling the parent class initializer.
- #scheduled_messages(active = false) ⇒ Object
-
#scheduled_messages? ⇒ Boolean
Is this an ActiveJob topic.
-
#to_h ⇒ Hash
messages namespace settings.
Instance Method Details
#initialize ⇒ Object
This method sets up the extra instance variable to nil before calling the parent class initializer. The explicit initialization to nil is included as an optimization for Ruby's object shapes system, which improves memory layout and access performance.
44 45 46 47 |
# File 'lib/karafka/pro/routing/features/consumer_groups/scheduled_messages/topic.rb', line 44 def initialize(...) @scheduled_messages = nil super end |
#scheduled_messages(active = false) ⇒ Object
51 52 53 |
# File 'lib/karafka/pro/routing/features/consumer_groups/scheduled_messages/topic.rb', line 51 def (active = false) @scheduled_messages ||= Config.new(active: active) end |
#scheduled_messages? ⇒ Boolean
Returns is this an ActiveJob topic.
56 57 58 |
# File 'lib/karafka/pro/routing/features/consumer_groups/scheduled_messages/topic.rb', line 56 def .active? end |
#to_h ⇒ Hash
messages namespace settings
62 63 64 65 66 |
# File 'lib/karafka/pro/routing/features/consumer_groups/scheduled_messages/topic.rb', line 62 def to_h super.merge( scheduled_messages: .to_h ).freeze end |