Sha256: cf92d8ff1001baac51f977c85b82e4f59f6d98a820fc07d1ebd616c8fb6b37dd
Contents?: true
Size: 1.77 KB
Versions: 60
Compression:
Stored size: 1.77 KB
Contents
# frozen_string_literal: true # This Karafka component is a Pro component under a commercial license. # This Karafka component is NOT licensed under LGPL. # # All of the commercial components are present in the lib/karafka/pro directory of this # repository and their usage requires commercial license agreement. # # Karafka has also commercial-friendly license, commercial support and commercial components. # # By sending a pull request to the pro components, you are agreeing to transfer the copyright of # your code to Maciej Mensfeld. module Karafka module Pro module Routing module Features class Expiring < Base # Topic expiring API extensions module Topic # @param ttl [Integer, nil] maximum time in ms a message is considered alive 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 # Just an alias for nice API # # @param args [Array] Anything `#expiring` accepts def expire_in(*args) expiring(*args) end # @return [Boolean] is a given job expiring def expiring? expiring.active? end # @return [Hash] topic with all its native configuration options plus expiring def to_h super.merge( expiring: expiring.to_h ).freeze end end end end end end end
Version data entries
60 entries across 60 versions & 1 rubygems