Sha256: 19849030ea5098702af76eaaa825876e5cbc5abcda98e58407f501497eb09dd8

Contents?: true

Size: 1.78 KB

Versions: 15

Compression:

Stored size: 1.78 KB

Contents

module Messaging
  class Config
    extend ::Dry::Configurable

    setting :app_name, 'messaging', reader: true

    setting(:error_handlers, [], reader: true) { |value| Array(value) }

    setting :background_job_handler, ->(message, handler_name) { handler_name.constantize.call(message) }, reader: true

    setting :logger, Logger.new(STDOUT), reader: true

    setting :consumer, reader: true do
      setting :adapter, :kafka
      setting(:middlewares, []) { |value| Array(value) }
    end

    setting :dispatcher, reader: true do
      setting :adapter, :kafka
      setting(:middlewares, []) { |value| Array(value) }
    end

    setting :message_store, reader: true do
      setting :adapter, :postgres
      setting(:middlewares, []) { |value| Array(value) }
    end

    setting :kafka, reader: true do
      setting :log_level, :warn
      setting :pause_timeout, 10

      setting :client do
        setting :seed_brokers, ['localhost:9092']
        setting :connect_timeout
        setting :socket_timeout
        setting :ssl_ca_certs_from_system
        setting :sasl_plain_username
        setting :sasl_plain_password
        setting :ssl_ca_cert, ENV['KAFKA_SSL_CA']
        setting :ssl_client_cert, ENV['KAFKA_SSL_CERTIFICATE']
        setting :ssl_client_cert_key, ENV['KAFKA_SSL_KEY']
      end

      setting :consumer do
        setting :session_timeout, 30
        setting :offset_commit_interval, 10
        setting :offset_commit_threshold, 0
        setting :heartbeat_interval, 10
      end

      setting :producer do
        setting :max_queue_size, 5_000
        setting :delivery_threshold, 10
        setting :delivery_interval, 0.05
      end
    end

    class << self
      def setup
        configure do |config|
          yield(config)
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
messaging-3.7.2 lib/messaging/config.rb
messaging-3.7.1 lib/messaging/config.rb
messaging-3.7.0 lib/messaging/config.rb
messaging-3.6.2 lib/messaging/config.rb
messaging-3.6.0 lib/messaging/config.rb
messaging-3.5.7 lib/messaging/config.rb
messaging-3.5.6 lib/messaging/config.rb
messaging-3.5.5 lib/messaging/config.rb
messaging-3.5.4 lib/messaging/config.rb
messaging-3.5.3 lib/messaging/config.rb
messaging-3.5.2 lib/messaging/config.rb
messaging-3.5.1 lib/messaging/config.rb
messaging-3.4.3 lib/messaging/config.rb
messaging-3.4.2 lib/messaging/config.rb
messaging-3.4.1 lib/messaging/config.rb