Danube-client
An async Rust client library for interacting with Danube Pub/Sub messaging platform.
Danube is an open-source distributed Pub/Sub messaging platform written in Rust. Consult the documentation for supported concepts and the platform architecture.
Example usage
Check out the example files.
Producer
let client = builder
.service_url
.build
.unwrap;
let topic_name = "/default/test_topic";
let producer_name = "test_prod";
let mut producer = client
.new_producer
.with_topic
.with_name
.build;
producer.create.await?;
println!;
let encoded_data = "Hello Danube".as_bytes.to_vec;
let message_id = producer.send.await?;
println!;
Consumer
let client = builder
.service_url
.build
.unwrap;
let topic = "/default/test_topic";
let consumer_name = "test_cons";
let subscription_name = "test_subs";
let mut consumer = client
.new_consumer
.with_topic
.with_consumer_name
.with_subscription
.with_subscription_type
.build;
// Subscribe to the topic
consumer.subscribe.await?;
println!;
// Start receiving messages
let mut message_stream = consumer.receive.await?;
while let Some = message_stream.recv.await
Contribution
Check the documentation on how to setup a Danube Broker.