| Crates.io | iggy_stream_wrapper |
| lib.rs | iggy_stream_wrapper |
| version | 0.1.0 |
| created_at | 2025-05-05 21:38:00.607231+00 |
| updated_at | 2025-05-05 21:38:00.607231+00 |
| description | A small wrapper to improve ergonomics around Iggy streams |
| homepage | |
| repository | https://github.com/sigaloid/iggy_stream_wrapper |
| max_upload_size | |
| id | 1661535 |
| size | 108,832 |
This library provides an implementation of a MessageStream which is designed to asynchronously retrieve messages from a message broker using the Iggy client. It includes functionality for polling messages at a specified interval and managing message buffers.
To create a MessageStream, you can use the new method or the default method.
use iggy::client::MessageClient;
use iggy::clients::client::IggyClient;
use iggy::identifier::Identifier;
use std::sync::Arc;
use std::time::Duration;
let client = Arc::new(IggyClient::new());
let stream_id = Identifier::new();
let topic_id = Identifier::new();
// Using the new method
let message_stream = MessageStream::new(
client.clone(),
stream_id.clone(),
topic_id.clone(),
Some(1),
Consumer::default(),
Duration::from_millis(500),
10,
);
// OR: Using the default method
let message_stream = MessageStream::default(client, stream_id, topic_id);
while let Some(message) = message_stream.next().await? {
// Process message
}