Class: EventStoreClient::Config

Inherits:
Object
  • Object
show all
Includes:
Extensions::OptionsExtension
Defined in:
lib/event_store_client/config.rb

Constant Summary collapse

CHANNEL_ARGS_DEFAULTS =
{
  # These three options reduce delays between failed requests.
  'grpc.min_reconnect_backoff_ms' => 100, # milliseconds
  'grpc.max_reconnect_backoff_ms' => 100, # milliseconds
  'grpc.initial_reconnect_backoff_ms' => 100 # milliseconds
}.freeze

Instance Method Summary collapse

Methods included from Extensions::OptionsExtension

included, #initialize, #options_hash

Instance Method Details

#channel_args=(val) ⇒ Hash

Parameters:

  • val (Hash, nil)

Returns:

  • (Hash)


48
49
50
51
52
53
54
# File 'lib/event_store_client/config.rb', line 48

def channel_args=(val)
  channel_args = CHANNEL_ARGS_DEFAULTS.merge(val&.transform_keys(&:to_s) || {})
  # This options always defaults to `0`. This is because `event_store_client` implements its
  # own retry functional.
  channel_args['grpc.enable_retries'] = 0
  @channel_args = channel_args
end

#eventstore_url=(value) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/event_store_client/config.rb', line 28

def eventstore_url=(value)
  @eventstore_url =
    if value.is_a?(Connection::Url)
      value
    else
      Connection::UrlParser.new.call(value)
    end
end

#logger=(logger) ⇒ Logger?

Parameters:

  • logger (Logger, nil)

Returns:

  • (Logger, nil)


39
40
41
42
43
44
# File 'lib/event_store_client/config.rb', line 39

def logger=(logger)
  ::GRPC.define_singleton_method :logger do
    @logger ||= logger.nil? ? ::GRPC::DefaultLogger::NoopLogger.new : logger
  end
  @logger = logger
end