Module: Karafka::Pro::Routing::Features::Expiring::Topic
- Defined in:
- lib/karafka/pro/routing/features/expiring/topic.rb
Overview
Topic expiring API extensions
Instance Method Summary collapse
-
#expire_in(*args) ⇒ Object
Just an alias for nice API.
- #expiring(ttl = nil) ⇒ Object
-
#expiring? ⇒ Boolean
Is a given job expiring.
-
#to_h ⇒ Hash
Topic with all its native configuration options plus expiring.
Instance Method Details
#expire_in(*args) ⇒ Object
Just an alias for nice API
31 32 33 |
# File 'lib/karafka/pro/routing/features/expiring/topic.rb', line 31 def expire_in(*args) expiring(*args) end |
#expiring(ttl = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/karafka/pro/routing/features/expiring/topic.rb', line 14 def expiring(ttl = nil) # Those settings are used for validation @expiring ||= begin config = Config.new(active: !ttl.nil?, ttl: ttl) if config.active? factory = ->(*) { Pro::Processing::Filters::Expirer.new(ttl) } filter(factory) end config end end |
#expiring? ⇒ Boolean
Returns is a given job expiring.
36 37 38 |
# File 'lib/karafka/pro/routing/features/expiring/topic.rb', line 36 def expiring? expiring.active? end |
#to_h ⇒ Hash
Returns topic with all its native configuration options plus expiring.
41 42 43 44 45 |
# File 'lib/karafka/pro/routing/features/expiring/topic.rb', line 41 def to_h super.merge( expiring: expiring.to_h ).freeze end |