Module: Karafka::Pro::Routing::Features::ConsumerGroups::Delaying::Topic
- Defined in:
- lib/karafka/pro/routing/features/consumer_groups/delaying/topic.rb
Overview
Topic delaying API extensions
Instance Method Summary collapse
-
#delay_by ⇒ Object
Just an alias for nice API.
- #delaying(delay = nil) ⇒ Object
-
#delaying? ⇒ Boolean
Is a given job delaying.
-
#initialize ⇒ Object
This method sets up the extra instance variable to nil before calling the parent class initializer.
-
#to_h ⇒ Hash
Topic with all its native configuration options plus delaying.
Instance Method Details
#delay_by ⇒ Object
Just an alias for nice API
64 65 66 |
# File 'lib/karafka/pro/routing/features/consumer_groups/delaying/topic.rb', line 64 def delay_by(*) (*) end |
#delaying(delay = nil) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/karafka/pro/routing/features/consumer_groups/delaying/topic.rb', line 49 def (delay = nil) # Those settings are used for validation @delaying ||= begin config = Config.new(active: !delay.nil?, delay: delay) if config.active? factory = ->(*) { Pro::Processing::ConsumerGroups::Filters::Delayer.new(delay) } filter(factory) end config end end |
#delaying? ⇒ Boolean
Returns is a given job delaying.
69 70 71 |
# File 'lib/karafka/pro/routing/features/consumer_groups/delaying/topic.rb', line 69 def .active? end |
#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.
43 44 45 46 |
# File 'lib/karafka/pro/routing/features/consumer_groups/delaying/topic.rb', line 43 def initialize(...) @delaying = nil super end |
#to_h ⇒ Hash
Returns topic with all its native configuration options plus delaying.
74 75 76 77 78 |
# File 'lib/karafka/pro/routing/features/consumer_groups/delaying/topic.rb', line 74 def to_h super.merge( delaying: .to_h ).freeze end |