Sha256: ef4cfa90486cfd03726d937580150c9df05120ba146e76957938f8eed93720d1

Contents?: true

Size: 803 Bytes

Versions: 8

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module ActiveJob
    # Contract for validating the options that can be altered with `#karafka_options` per job class
    # @note We keep this in the `Karafka::ActiveJob` namespace instead of `Karafka::Contracts` as
    #   we want to keep ActiveJob related Karafka components outside of the core Karafka code and
    #   all in the same place
    class JobOptionsContract < Contracts::Base
      configure do |config|
        config.error_messages = YAML.safe_load(
          File.read(
            File.join(Karafka.gem_root, 'config', 'locales', 'errors.yml')
          )
        ).fetch('en').fetch('validations').fetch('job_options')
      end

      optional(:dispatch_method) { |val| %i[produce_async produce_sync].include?(val) }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
karafka-2.0.32 lib/karafka/active_job/job_options_contract.rb
karafka-2.0.31 lib/karafka/active_job/job_options_contract.rb
karafka-2.0.30 lib/karafka/active_job/job_options_contract.rb
karafka-2.0.29 lib/karafka/active_job/job_options_contract.rb
karafka-2.0.28 lib/karafka/active_job/job_options_contract.rb
karafka-2.0.27 lib/karafka/active_job/job_options_contract.rb
karafka-2.0.26 lib/karafka/active_job/job_options_contract.rb
karafka-2.0.24 lib/karafka/active_job/job_options_contract.rb