iggy_stream_wrapper

Crates.ioiggy_stream_wrapper
lib.rsiggy_stream_wrapper
version0.1.0
created_at2025-05-05 21:38:00.607231+00
updated_at2025-05-05 21:38:00.607231+00
descriptionA small wrapper to improve ergonomics around Iggy streams
homepage
repositoryhttps://github.com/sigaloid/iggy_stream_wrapper
max_upload_size
id1661535
size108,832
Matthew Esposito (sigaloid)

documentation

README

MessageStream Library

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.

Features

  • Asynchronous message retrieval
  • Configurable polling interval and batch size
  • Automatic message buffering

Usage

Creating a MessageStream

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
}

Commit count: 4

cargo fmt