View Source Spear.Connection.Configuration (Spear v1.4.1)
Configuration for Spear.Connection
s
Options
:name
- the name of the GenServer. SeeGenServer.name/0
for more information. When not provided, the spawned process is not aliased to a name and is only addressable through its PID.:connection_string
- the connection string to parse containing all connection information. Other options like:host
or:port
will be parsed from the connection string. If options parsed from the connection string are passed, they will be treated as overrides to the value found in the connection string. Consult the EventStoreDB documentation for formulating a valid connection string.:mint_opts
- (default:[protocols: [:http2], mode: :active]
) a keyword list of options to pass to mint. The default values cannot be overridden. This can be useful for configuring TLS. See the security guide for more information.:host
- (default:"localhost"
) the host address of the EventStoreDB:port
- (default:2113
) the external gRPC port of the EventStoreDB:tls?
- (default:false
) whether or not to use TLS to secure the connection to the EventStoreDB:username
- (default:"admin"
) the user to connect as:password
- (default:"changeit"
) the user's password:keep_alive_interval
- (default:10_000
ms - 10s) the period to send keep-alive pings to the EventStoreDB. Set-1
to disable keep-alive checks. Should be any integer value>= 10_000
. This option can be used in conjunction with:keep_alive_timeout
to properly disconnect if the EventStoreDB is not responding to network traffic.:keep_alive_timeout
- (default:10_000
ms - 10s) the time after sending a keep-alive ping when the ping will be considered unacknowledged. Used in conjunction with:keep_alive_interval
. Set to-1
to disable keep-alive checks. Should be any integer value>= 10_000
.:read_only?
- (default:false
) controls whether the connection should be limited to read-only functionality. The list of read-only APIs can be queried withSpear.Connection.read_apis/0
:on_connect
- (default:nil
) a 0-arity fun or MFA to be called when the connection is established.:on_disconnect
- (default:nil
) a 0-arity fun or MFA to be called when the connection is lost.
See the Spear.Connection
module docs for more information about keep-alive.
Summary
Types
Configuration for a Spear.Connection
.
Types
@type t() :: %Spear.Connection.Configuration{ errors: Keyword.t(), host: Mint.Types.address(), keep_alive_interval: pos_integer() | false, keep_alive_timeout: pos_integer() | false, mint_opts: Keyword.t(), on_connect: (... -> any()) | {module(), atom(), [any()]} | nil, on_disconnect: (... -> any()) | {module(), atom(), [any()]} | nil, password: String.t() | nil, port: :inet.port_number(), read_only?: boolean(), scheme: :http | :https, tls?: boolean(), username: String.t() | nil, valid?: boolean() }
Configuration for a Spear.Connection
.
Functions
Parses configuration from a keyword list
This function is used internally by Spear.Connection
when connecting.