Sha256: 822be748897dcb35b744775894b980def955099879f349615fb81e857f533c80

Contents?: true

Size: 1.03 KB

Versions: 16

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Karafka
  # ActiveJob related Karafka stuff
  module ActiveJob
    # Karafka routing ActiveJob related components
    module Routing
      # Routing extensions for ActiveJob
      module Extensions
        # This method simplifies routes definition for ActiveJob topics / queues by auto-injecting
        # the consumer class
        # @param name [String, Symbol] name of the topic where ActiveJobs jobs should go
        # @param block [Proc] block that we can use for some extra configuration
        def active_job_topic(name, &block)
          topic(name) do
            consumer App.config.internal.active_job.consumer_class

            next unless block

            instance_eval(&block)

            # This is handled by our custom ActiveJob consumer
            # Without this, default behaviour would cause messages to skip upon shutdown as the
            # offset would be committed for the last message
            manual_offset_management true
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
karafka-2.0.8 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.7 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.6 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.5 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.4 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.3 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.2 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.1 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.0 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.0.rc6 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.0.rc5 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.0.rc4 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.0.rc3 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.0.rc2 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.0.rc1 lib/karafka/active_job/routing/extensions.rb
karafka-2.0.0.beta5 lib/karafka/active_job/routing/extensions.rb