Struct rants::Client [−][src]
pub struct Client { /* fields omitted */ }
Expand description
The entry point to the NATS client protocol
Implementations
Get the current state of the Client
Get a watch stream of Client
state transitions
Get a mutable reference to this Client
’s Connect
Get a mutable reference to the list of addresses used to try and establish a connection to a server.
Get the configured TCP connect timeout. [default = 10s
]
This is the timeout of a single connect attempt. It is not the timeout of the
connect
future which has no internal timeout.
Set the TCP connect timeout.
Get the DelayGenerator
The default generator is generated with generate_delay_generator
with the following parameters:
connect_series_attempts_before_cool_down
=3
connect_delay
=0s
connect_series_delay
=5s
cool_down
=60s
Return a reference to a Subscription
if the client is aware
of the specified subscription ID
Connect to a NATS server
This will randomly shuffle a list consisting of all explicitly specified
addresses and
addresses received in an INFO
message’s connect_urls
.
A randomized list of addresses is used to avoid a
thundering herd.
The client will continuously try to connect to each address in this list. The timeout of
each connect attempt is specified by the
tcp_connect_timeout
. The delay between
each connect attempt is specified by the
delay_generator_mut
.
When this future resolves, we are guaranteed to have entered the
Connected
state.
Unless, disconnect
was called.
Should the client become disconnected for any reason, other than calling
disconnect
, the client will continuously try
to reconnect. Upon a successful reconnect, the client will automatically subscribe to all
subscriptions.
Disconnect from the NATS server
When this future resolves, we are guaranteed to have entered the
Disconnected
state.
Note: Client
does not disconnect
when it is Drop
ped. In order to
avoid leaking futures, you must explicitly call disconnect
.
Convenience wrapper around publish_with_optional_reply
Convenience wrapper around publish_with_optional_reply
Implements the request-reply pattern
Implements the request-reply pattern with a timeout
Convenience wrapper around subscribe_with_optional_queue_group
Convenience wrapper around subscribe_with_optional_queue_group
Convenience wrapper around unsubscribe_optional_max_msgs
Convenience wrapper around unsubscribe_optional_max_msgs
Unsubscribe from all subscriptions
Get a watch stream of INFO
messages received from the server
Get a watch stream of PING
messages received from the server
Get a watch stream of PONG
messages received from the server
Get a watch stream of +OK
messages received from the server
Get a watch stream of -ERR
messages received from the server
Send a PING
to the server.
This method, coupled with a pong_stream
, can be a useful way to check that the client is
still connected to the server.
Send a PONG
to the server.
Note: you do not have to manually send a PONG
as part of the servers ping/pong keep
alive. The client library automatically handles replying to pings. You should not need
to use this method.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
Blanket Implementations
Mutably borrows from an owned value. Read more