pub struct Environment { /* private fields */ }
Expand description
Main access point to a node
Implementations§
Source§impl Environment
impl Environment
pub fn builder() -> EnvironmentBuilder
Sourcepub async fn from_client_option(
client_options: impl Into<ClientOptions>,
) -> RabbitMQStreamResult<Self>
pub async fn from_client_option( client_options: impl Into<ClientOptions>, ) -> RabbitMQStreamResult<Self>
Create environment instance from client options.
This allow to create an Environment
instance from configuration.
use rabbitmq_stream_client::Environment;
use rabbitmq_stream_client::ClientOptions;
#[derive(serde::Deserialize)]
struct MyConfig {
rabbitmq: ClientOptions
}
let j = r#"
{
"rabbitmq": {
"host": "localhost",
"tls": {
"enabled": false
}
}
}
"#;
let my_config: MyConfig = serde_json::from_str(j).unwrap();
let env = Environment::from_client_option(my_config.rabbitmq)
.await
.unwrap();
Sourcepub fn stream_creator(&self) -> StreamCreator
pub fn stream_creator(&self) -> StreamCreator
Returns a builder for creating a stream with a specific configuration
Sourcepub fn producer(&self) -> ProducerBuilder<NoDedup>
pub fn producer(&self) -> ProducerBuilder<NoDedup>
Returns a builder for creating a producer
pub fn super_stream_producer( &self, routing_strategy: RoutingStrategy, ) -> SuperStreamProducerBuilder<NoDedup>
Sourcepub fn consumer(&self) -> ConsumerBuilder
pub fn consumer(&self) -> ConsumerBuilder
Returns a builder for creating a consumer
pub fn super_stream_consumer(&self) -> SuperStreamConsumerBuilder
Sourcepub async fn delete_stream(&self, stream: &str) -> Result<(), StreamDeleteError>
pub async fn delete_stream(&self, stream: &str) -> Result<(), StreamDeleteError>
Delete a stream
pub async fn delete_super_stream( &self, super_stream: &str, ) -> Result<(), StreamDeleteError>
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for Environment
impl !RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl !UnwindSafe for Environment
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