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
39 40 41 |
# File 'lib/karafka/pro/routing/features/delaying/topic.rb', line 39 def delay_by(*args) (*args) end |
#delaying(delay = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/karafka/pro/routing/features/delaying/topic.rb', line 22 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.
44 45 46 |
# File 'lib/karafka/pro/routing/features/delaying/topic.rb', line 44 def .active? end |
#to_h ⇒ Hash
Returns topic with all its native configuration options plus delaying.
49 50 51 52 53 |
# File 'lib/karafka/pro/routing/features/delaying/topic.rb', line 49 def to_h super.merge( delaying: .to_h ).freeze end |