RabbitMQ Stream Client
A Rust Client for RabbitMQ Stream Queues
Installation
Install from crates.io
[]
= "*"
Quick Start
The main access point is Environment
, which is used to connect to a node.
Example
Building the environment
use Environment;
let environment = builder.build.await?;
Building the environment with TLS
use Environment;
let tls_configuration: TlsConfiguration = builder
.add_root_certificates
.build;
// Use this configuration if you want to trust the certificates
// without providing the root certificate
let tls_configuration: TlsConfiguration = builder
.trust_certificates
.build;
let environment = builder
.host
.port // specify the TLS port of the node
.tls
.build
Publishing messages
use ;
let environment = builder.build.await?;
let producer = environment.producer.name.build.await?;
for i in 0..10
producer.close.await?;
Consuming messages
use ;
use StreamExt;
use task;
use ;
let environment = builder.build.await?;
let mut consumer = environment.consumer.build.await?;
let handle = consumer.handle;
spawn;
// wait 10 second and then close the consumer
sleep.await;
handle.close.await?;
Development
Compiling
Running Tests
To run tests you need to have a running RabbitMQ Stream node with a TLS configuration.
It is mandatory to use make rabbitmq-server
to create a TLS configuration compatible with the tests.
See the Environment
TLS tests for more details.
Running Benchmarks