Class: EventStoreClient::GRPC::Connection

Inherits:
Object
  • Object
show all
Includes:
Configuration
Defined in:
lib/event_store_client/adapters/grpc/connection.rb

Instance Method Summary collapse

Methods included from Configuration

#config

Instance Method Details

#call(stub_klass, options: {}) ⇒ Stub

Initializes the proper stub with the necessary credentials to create working gRPC connection - Refer to generated grpc files

Returns:

  • (Stub)

    Instance of a given ‘Stub` klass



16
17
18
19
20
21
22
23
24
25
# File 'lib/event_store_client/adapters/grpc/connection.rb', line 16

def call(stub_klass, options: {})
  credentials =
    options[:credentials] ||
    Base64.encode64("#{config.eventstore_user}:#{config.eventstore_password}")
  stub_klass.new(
    "#{config.eventstore_url.host}:#{config.eventstore_url.port}",
    channel_credentials,
    channel_args: { 'authorization' => "Basic #{credentials.delete("\n")}" }
  )
end