struct
Crabbit::Configuration
- Crabbit::Configuration
- Struct
- Value
- Object
Overview
Immutable connection, authentication, timeout, and protocol configuration.
Configuration.parse is convenient for one URI endpoint. Construct this
type directly to supply multiple entrypoints, custom SASL, or load-balancer
mode.
Defined in:
crabbit/configuration.crConstant Summary
-
DEFAULT_URI =
"rabbitmq-stream://guest:guest@localhost:5552/%2f" -
Default local RabbitMQ Stream URI.
Constructors
-
.new(endpoints : Array(Endpoint) = [Endpoint.new("localhost")], username : String = "guest", password : String = "guest", virtual_host : String = "/", sasl : SaslMechanism = SaslMechanism::Plain, sasl_authenticator : SaslAuthenticator | Nil = nil, oauth2 : OAuth2Config | Nil = nil, tls : TLSConfig | Nil = nil, heartbeat : Time::Span = 60.seconds, max_frame_size : UInt32 = 1048576_u32, connection_timeout : Time::Span = 10.seconds, request_timeout : Time::Span = 10.seconds, client_properties : Hash(String, String) = {} of String => String, load_balancer : Bool = false)
Creates a connection configuration.
-
.parse(uri : String = DEFAULT_URI, tls : TLSConfig | Nil = nil, **options) : self
Parses a RabbitMQ Stream URI into a configuration.
Instance Method Summary
-
#authenticator : SaslAuthenticator
Returns the effective authenticator for this configuration.
-
#client_properties : Hash(String, String)
Returns client properties sent during Peer Properties negotiation.
-
#connection_timeout : Time::Span
Returns the TCP/TLS connection timeout.
-
#endpoints : Array(Endpoint)
Returns seed endpoints used for metadata and load-balanced connections.
-
#heartbeat : Time::Span
Returns the requested heartbeat interval; zero disables heartbeats.
-
#load_balancer : Bool
Returns whether broker connections must be reached through seed endpoints.
-
#max_frame_size : UInt32
Returns the requested maximum frame size; zero means no local limit.
-
#oauth2 : OAuth2Config | Nil
Returns the optional OAuth 2 configuration.
-
#password : String
Returns the SASL PLAIN password.
-
#request_timeout : Time::Span
Returns the timeout for correlated protocol requests.
-
#sasl : SaslMechanism
Returns the selected built-in SASL mechanism.
-
#sasl_authenticator : SaslAuthenticator | Nil
Returns the optional custom SASL authenticator.
-
#tls : TLSConfig | Nil
Returns TLS settings, or
nilfor plain Stream connections. -
#username : String
Returns the SASL PLAIN username.
-
#virtual_host : String
Returns the RabbitMQ virtual host.
Constructor Detail
Creates a connection configuration.
Crabbit rotates through endpoints for locator connections. With load_balancer, it also opens producer and consumer connections through those entrypoints until RabbitMQ advertises the metadata-selected node.
client_properties augment the default product, version, platform, and
information fields. Supplying oauth2 creates a shared
OAuth2SaslAuthenticator; oauth2 and sasl_authenticator are mutually
exclusive.
Parses a RabbitMQ Stream URI into a configuration.
Supported schemes are rabbitmq-stream and rabbitmq-stream+tls.
Username, password, and virtual host are percent-decoded. Additional
named options are forwarded to .new.
tls = Crabbit::TLSConfig.new(custom_context)
config = Crabbit::Configuration.parse(
"rabbitmq-stream+tls://user:secret@rabbit.example/%2f",
tls: tls,
heartbeat: 30.seconds,
)
Instance Method Detail
Returns client properties sent during Peer Properties negotiation.
Returns seed endpoints used for metadata and load-balanced connections.
Returns whether broker connections must be reached through seed endpoints.
Returns TLS settings, or nil for plain Stream connections.