Expand description

Getting started

To get started with Memphis, you need to install the Memphis server. You can find the installation instructions here

Connecting to Memphis and Consuming Messages

use memphis_rust_community::memphis_client::MemphisClient;
use memphis_rust_community::consumer::MemphisConsumerOptions;
use memphis_rust_community::station::MemphisStationsOptions;

#[tokio::main]
async fn main() {
    let client = MemphisClient::new("localhost:6666", "root", "memphis", None).await.unwrap();

    let station_options = MemphisStationsOptions::new("my-station");
    let station = client.create_station(station_options).await.unwrap();

    let consumer_options = MemphisConsumerOptions::new("my-consumer")
        .with_generate_unique_suffix(true);
    let mut consumer = station.create_consumer(consumer_options).await.unwrap();

    let mut message_receiver = consumer.consume().await.unwrap();
    tokio::spawn(async move {
        loop{
            let msg = message_receiver.recv().await;
            // Do something with the message
            break;
        }
    });
}

Modules

Enums