Sha256: 8801a6bd988635c6e7f870dded73dff950be333c5084f1cc7526a2b1e4d60efc

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

# frozen_string_literal: true

class RailsTransactionalOutbox
  class Configuration
    attr_accessor :database_connection_provider, :logger, :outbox_model, :transaction_provider
    attr_writer :error_handler, :transactional_outbox_worker_sleep_seconds,
      :transactional_outbox_worker_idle_delay_multiplier, :outbox_batch_size, :outbox_entries_processor,
      :lock_client, :lock_expiry_time, :outbox_entry_causality_key_resolver

    def error_handler
      @error_handler || RailsTransactionalOutbox::ErrorHandlers::NullErrorHandler
    end

    def transactional_outbox_worker_sleep_seconds
      @transactional_outbox_worker_sleep_seconds || 0.5
    end

    def transactional_outbox_worker_idle_delay_multiplier
      @transactional_outbox_worker_idle_delay_multiplier || 10
    end

    def outbox_batch_size
      @outbox_batch_size || 100
    end

    def record_processors
      @record_processors ||= [RailsTransactionalOutbox::RecordProcessors::ActiveRecordProcessor.new]
    end

    def add_record_processor(record_processor)
      record_processors << record_processor
    end

    def outbox_entries_processor
      @outbox_entries_processor ||= RailsTransactionalOutbox::OutboxEntriesProcessors::NonOrderedProcessor.new
    end

    def lock_client
      @lock_client || RailsTransactionalOutbox::NullLockClient
    end

    def lock_expiry_time
      @lock_expiry_time || 10_000
    end

    def outbox_entry_causality_key_resolver
      @outbox_entry_causality_key_resolver || ->(_model) {}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails-transactional-outbox-0.3.0 lib/rails_transactional_outbox/configuration.rb
rails-transactional-outbox-0.2.1 lib/rails_transactional_outbox/configuration.rb
rails-transactional-outbox-0.2.0 lib/rails_transactional_outbox/configuration.rb