Module: Karafka::Pro::Routing::Features::ScheduledMessages::Topic
- Defined in:
- lib/karafka/pro/routing/features/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 calls the parent class initializer and then sets up the extra instance variable to nil.
- #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 calls the parent class initializer and then sets up the extra instance variable to nil. The explicit initialization to nil is included as an optimization for Ruby’s object shapes system, which improves memory layout and access performance.
43 44 45 46 |
# File 'lib/karafka/pro/routing/features/scheduled_messages/topic.rb', line 43 def initialize(...) super @scheduled_messages = nil end |
#scheduled_messages(active = false) ⇒ Object
49 50 51 |
# File 'lib/karafka/pro/routing/features/scheduled_messages/topic.rb', line 49 def (active = false) @scheduled_messages ||= Config.new(active: active) end |
#scheduled_messages? ⇒ Boolean
Returns is this an ActiveJob topic.
54 55 56 |
# File 'lib/karafka/pro/routing/features/scheduled_messages/topic.rb', line 54 def .active? end |
#to_h ⇒ Hash
messages namespace settings
60 61 62 63 64 |
# File 'lib/karafka/pro/routing/features/scheduled_messages/topic.rb', line 60 def to_h super.merge( scheduled_messages: .to_h ).freeze end |