Skip to content

CrabMQ/rust-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦀 CrabMQ Rust Client Library

This library provides a simple and efficient client for interacting with the CrabMQ queue server. With this library, you can easily publish and subscribe to messages over TCP.

✨ Features

  • 📤 Publish messages: Send messages to the queue server.
  • 📥 Subscribe to messages: Receive messages from the queue server.

📦 Installation

Add this to your Cargo.toml:

[dependencies]
crabmq = "1.0.0"

🚀 Usage

🔌 Connecting to the Queue Server

You can connect to the CrabMQ server as a publisher or a subscriber.

📤 Publisher

use crabmq::Client;

#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
    let mut publisher = Client::publisher("127.0.0.1:8080").await?;

    publisher.publish(b"Hello, world!").await?;

    Ok(())
}

📥 Subscriber

use crabmq::Client;

#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
    let mut subscriber = Client::subscriber("127.0.0.1:8080").await?;

    loop {
        let message = subscriber.listen().await?;
        println!("Received: {:?}", message);
    }
}

🤝 Contributing

Feel free to open issues or submit pull requests if you find bugs or want to contribute improvements.

About

Rust Client to interact with CrabMQ.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages