Module: Karafka::Pro::Routing::Features::Delaying::Topic
- Defined in:
- lib/karafka/pro/routing/features/delaying/topic.rb
Overview
Topic delaying API extensions
Instance Method Summary collapse
-
#delay_by(*args) ⇒ Object
Just an alias for nice API.
- #delaying(delay = nil) ⇒ Object
-
#delaying? ⇒ Boolean
Is a given job delaying.
-
#to_h ⇒ Hash
Topic with all its native configuration options plus delaying.
Instance Method Details
#delay_by(*args) ⇒ Object
Just an alias for nice API
31 32 33 |
# File 'lib/karafka/pro/routing/features/delaying/topic.rb', line 31 def delay_by(*args) (*args) end |
#delaying(delay = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/karafka/pro/routing/features/delaying/topic.rb', line 14 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::Filters::Delayer.new(delay) } filter(factory) end config end end |
#delaying? ⇒ Boolean
Returns is a given job delaying.
36 37 38 |
# File 'lib/karafka/pro/routing/features/delaying/topic.rb', line 36 def .active? end |
#to_h ⇒ Hash
Returns topic with all its native configuration options plus delaying.
41 42 43 44 45 |
# File 'lib/karafka/pro/routing/features/delaying/topic.rb', line 41 def to_h super.merge( delaying: .to_h ).freeze end |