3 releases (stable)
1.0.1 | Feb 19, 2024 |
---|---|
0.2.0 | Feb 18, 2024 |
#775 in Database interfaces
8KB
127 lines
Aurora Streams
A Rust library for managing publish-subscribe channels using Tokio message passing channels.
Optionally remote event routing can be enabled using redis by passing the event-routing
feature flag, This allows pub-sub messages to be shared between multiple services.
Features:
- Simplified Pub/Sub Interaction
- Asynchronous Operations
- Duplicate Message Handling
- Channel Management
Getting Started:
Add the dependency to your Cargo.toml:
[dependencies]
aurora-streams = "0.1.0" # Replace with the actual version
Import the library in your Rust code:
use aurora_streams::create_stream;
Usage:
Create an AuroraStreams instance:
let streams = create_stream()
Create an AuroraStreams instance if event routing is enabled:
let streams = create_stream("redis://127.0.0.1:6387")
Create a channel:
streams.create_channel("test_channel".to_string()).await;
Publish a message:
streams.publish("test_channel".to_string(), "Hello World!".to_string()).await;
Subscribe to a channel:
streams.subscribe("test_channel".to_string(), |message| {
println!("Message received: {}", message);
}).await;
License:
This library is licensed under the MIT License.
Contributing:
Contributions are welcome! Please see the contributing guidelines for details.
Dependencies
~3–13MB
~130K SLoC