pub struct NatsConfig {
pub host: String,
pub port: u16,
pub store_dir: PathBuf,
pub js_domain: Option<String>,
pub remote_url: Option<String>,
pub credentials: Option<PathBuf>,
pub websocket_port: u16,
pub config_path: Option<PathBuf>,
}Expand description
Configuration for a NATS server that supports running either in “standalone” or “leaf” mode.
See the respective NatsConfig::new_standalone and NatsConfig::new_leaf implementations below for more information.
Fields§
§host: String§port: u16§store_dir: PathBufThe path where the NATS server will store its jetstream data. This must be different for each NATS server you spin up, otherwise they will share stream data
js_domain: Option<String>§remote_url: Option<String>§credentials: Option<PathBuf>§websocket_port: u16§config_path: Option<PathBuf>Implementations§
Source§impl NatsConfig
impl NatsConfig
Sourcepub fn new_leaf(
host: &str,
port: u16,
js_domain: Option<String>,
remote_url: String,
credentials: PathBuf,
websocket_port: u16,
config_path: Option<PathBuf>,
) -> Self
pub fn new_leaf( host: &str, port: u16, js_domain: Option<String>, remote_url: String, credentials: PathBuf, websocket_port: u16, config_path: Option<PathBuf>, ) -> Self
Instantiates config for a NATS leaf node. Leaf nodes are meant to extend an existing NATS infrastructure like Synadia’s NGS, but can also be used to extend your own NATS infrastructure. For more information, our Working with Leaf Nodes docs
§Arguments
host: NATS host to listen on, e.g.127.0.0.1port: NATS port to listen on, e.g.4222js_domain: Jetstream domain to use, defaults tocore. See Configuring Jetstream for more informationremote_url: URL of NATS cluster to extendcredentials: Credentials to authenticate to the existing NATS cluster
Sourcepub fn new_standalone(host: &str, port: u16, js_domain: Option<String>) -> Self
pub fn new_standalone(host: &str, port: u16, js_domain: Option<String>) -> Self
Instantiates config for a standalone NATS server. Unless you’re looking to extend existing NATS infrastructure, this is the preferred NATS server mode.
§Arguments
host: NATS host to listen on, e.g.127.0.0.1port: NATS port to listen on, e.g.4222js_domain: Jetstream domain to use, defaults tocore. See Configuring Jetstream for more information
pub async fn write_to_path<P>(self, path: P) -> Result<()>
Trait Implementations§
Source§impl Clone for NatsConfig
impl Clone for NatsConfig
Source§fn clone(&self) -> NatsConfig
fn clone(&self) -> NatsConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NatsConfig
impl Debug for NatsConfig
Source§impl Default for NatsConfig
Returns a standalone NATS config with the following values:
impl Default for NatsConfig
Returns a standalone NATS config with the following values:
host:127.0.0.1port:4222js_domain:Some("core")remote_url:Nonecredentials:Nonewebsocket_port:4223
Source§impl PartialEq for NatsConfig
impl PartialEq for NatsConfig
impl Eq for NatsConfig
impl StructuralPartialEq for NatsConfig
Auto Trait Implementations§
impl Freeze for NatsConfig
impl RefUnwindSafe for NatsConfig
impl Send for NatsConfig
impl Sync for NatsConfig
impl Unpin for NatsConfig
impl UnwindSafe for NatsConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more