pub struct NatsServer { /* private fields */ }Expand description
A nats-server process owned by a single test
The process is killed when this is dropped. If the test is panicking,
the tail of the server log is printed and the temporary directory
holding the config, the full log and the JetStream store is kept
around for inspection.
Implementations§
Source§impl NatsServer
impl NatsServer
Sourcepub fn builder() -> NatsServerBuilder
pub fn builder() -> NatsServerBuilder
Configure a new server
Sourcepub fn client_url(&self) -> &str
pub fn client_url(&self) -> &str
The nats:// URL clients should connect to
Sourcepub fn websocket_url(&self) -> Option<&str>
pub fn websocket_url(&self) -> Option<&str>
The ws:// URL clients should connect to
Returns None unless NatsServerBuilder::websocket was called.
Sourcepub async fn monitor(&self, path_and_query: &str) -> Value
pub async fn monitor(&self, path_and_query: &str) -> Value
Query a monitoring endpoint, like /connz?subs=1 or /varz
§Panics
Panics if the request fails or the response isn’t successful JSON.
Sourcepub async fn connections(&self) -> Vec<Value>
pub async fn connections(&self) -> Vec<Value>
The connections currently open with the server, including their subscriptions
Shorthand for the connections array of /connz?subs=1.
Sourcepub fn resume(&self)
pub fn resume(&self)
Resume a server frozen by NatsServer::pause
Trait Implementations§
Source§impl Debug for NatsServer
impl Debug for NatsServer
Source§impl Drop for NatsServer
impl Drop for NatsServer
Auto Trait Implementations§
impl !RefUnwindSafe for NatsServer
impl !UnwindSafe for NatsServer
impl Freeze for NatsServer
impl Send for NatsServer
impl Sync for NatsServer
impl Unpin for NatsServer
impl UnsafeUnpin for NatsServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more