Sha256: 98ffc36fcc07f8e04b5d01f52fae747994e12f99934597b3351f54159b22da10

Contents?: true

Size: 1.05 KB

Versions: 83

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Karafka
  module Routing
    module Features
      class ActiveJob < Base
        # Routing extensions for ActiveJob
        module Builder
          # 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
              active_job true

              # 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

              next unless block

              instance_eval(&block)
            end
          end
        end
      end
    end
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
karafka-2.3.3 lib/karafka/routing/features/active_job/builder.rb
karafka-2.3.2 lib/karafka/routing/features/active_job/builder.rb
karafka-2.3.1 lib/karafka/routing/features/active_job/builder.rb
karafka-2.3.0 lib/karafka/routing/features/active_job/builder.rb
karafka-2.3.0.rc1 lib/karafka/routing/features/active_job/builder.rb
karafka-2.3.0.alpha2 lib/karafka/routing/features/active_job/builder.rb
karafka-2.3.0.alpha1 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.14 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.13 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.12 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.11 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.10 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.9 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.8 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.8.beta1 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.7 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.6 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.5 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.4 lib/karafka/routing/features/active_job/builder.rb
karafka-2.2.3 lib/karafka/routing/features/active_job/builder.rb