Class: RubyEventStore::Outbox::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/outbox/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(split_keys:, message_format:, batch_size:, database_url:, redis_url:, cleanup:, cleanup_limit:, sleep_on_empty:, locking:) ⇒ Configuration



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ruby_event_store/outbox/configuration.rb', line 6

def initialize(
  split_keys:,
  message_format:,
  batch_size:,
  database_url:,
  redis_url:,
  cleanup:,
  cleanup_limit:,
  sleep_on_empty:,
  locking:
)
  @split_keys = split_keys
  @message_format = message_format
  @batch_size = batch_size || 100
  @database_url = database_url
  @redis_url = redis_url
  @cleanup = cleanup
  @cleanup_limit = cleanup_limit
  @sleep_on_empty = sleep_on_empty
  @locking = locking
  freeze
end

Instance Attribute Details

#batch_sizeObject (readonly)

Returns the value of attribute batch_size.



43
44
45
# File 'lib/ruby_event_store/outbox/configuration.rb', line 43

def batch_size
  @batch_size
end

#cleanupObject (readonly)

Returns the value of attribute cleanup.



43
44
45
# File 'lib/ruby_event_store/outbox/configuration.rb', line 43

def cleanup
  @cleanup
end

#cleanup_limitObject (readonly)

Returns the value of attribute cleanup_limit.



43
44
45
# File 'lib/ruby_event_store/outbox/configuration.rb', line 43

def cleanup_limit
  @cleanup_limit
end

#database_urlObject (readonly)

Returns the value of attribute database_url.



43
44
45
# File 'lib/ruby_event_store/outbox/configuration.rb', line 43

def database_url
  @database_url
end

#lockingObject (readonly)

Returns the value of attribute locking.



43
44
45
# File 'lib/ruby_event_store/outbox/configuration.rb', line 43

def locking
  @locking
end

#message_formatObject (readonly)

Returns the value of attribute message_format.



43
44
45
# File 'lib/ruby_event_store/outbox/configuration.rb', line 43

def message_format
  @message_format
end

#redis_urlObject (readonly)

Returns the value of attribute redis_url.



43
44
45
# File 'lib/ruby_event_store/outbox/configuration.rb', line 43

def redis_url
  @redis_url
end

#sleep_on_emptyObject (readonly)

Returns the value of attribute sleep_on_empty.



43
44
45
# File 'lib/ruby_event_store/outbox/configuration.rb', line 43

def sleep_on_empty
  @sleep_on_empty
end

#split_keysObject (readonly)

Returns the value of attribute split_keys.



43
44
45
# File 'lib/ruby_event_store/outbox/configuration.rb', line 43

def split_keys
  @split_keys
end

Instance Method Details

#with(overriden_options) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ruby_event_store/outbox/configuration.rb', line 29

def with(overriden_options)
  self.class.new(
    split_keys: overriden_options.fetch(:split_keys, split_keys),
    message_format: overriden_options.fetch(:message_format, message_format),
    batch_size: overriden_options.fetch(:batch_size, batch_size),
    database_url: overriden_options.fetch(:database_url, database_url),
    redis_url: overriden_options.fetch(:redis_url, redis_url),
    cleanup: overriden_options.fetch(:cleanup, cleanup),
    cleanup_limit: overriden_options.fetch(:cleanup_limit, cleanup_limit),
    sleep_on_empty: overriden_options.fetch(:sleep_on_empty, sleep_on_empty),
    locking: overriden_options.fetch(:locking, locking),
  )
end