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.
Constants
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.
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.
Sourceparse(uri :
String =
DEFAULT_URI, tls :
TLSConfig |
Nil = nil, **options) : self
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,
)
SourceInstance methods
authenticator
Returns the effective authenticator for this configuration.
Sourceclient_properties
Returns client properties sent during Peer Properties negotiation.
Sourceconnection_timeout
Returns the TCP/TLS connection timeout.
Sourceendpoints
Returns seed endpoints used for metadata and load-balanced connections.
Sourceheartbeat
Returns the requested heartbeat interval; zero disables heartbeats.
Sourceload_balancer
Returns whether broker connections must be reached through seed endpoints.
Sourcemax_frame_size
Returns the requested maximum frame size; zero means no local limit.
Sourceoauth2
Returns the optional OAuth 2 configuration.
Sourcepassword
Returns the SASL PLAIN password.
Sourcerequest_timeout
Returns the timeout for correlated protocol requests.
Sourcesasl
Returns the selected built-in SASL mechanism.
Sourcesasl_authenticator
Returns the optional custom SASL authenticator.
Sourcetls
Returns TLS settings, or nil for plain Stream connections.
Sourceusername
Returns the SASL PLAIN username.
Sourcevirtual_host
Returns the RabbitMQ virtual host.
Source