rabbitmq_servicess

Crates.iorabbitmq_servicess
lib.rsrabbitmq_servicess
version0.2.0
created_at2025-02-11 15:57:03.193356+00
updated_at2025-02-11 21:52:01.378801+00
descriptionA library to accelerate RabbitMQ deployment and management.
homepagehttps://github.com/SentineLLM-1/rabbitmq_service
repositoryhttps://github.com/SentineLLM-1/rabbitmq_service
max_upload_size
id1551575
size62,076
Florian BERA (fbera16)

documentation

https://docs.rs/rabbitmq_service

README

RabbitMQ Service

================

A library to accelerate RabbitMQ deployment and management.

Features

  • Connect to RabbitMQ using a specified URI.
  • Declare two queues: <queue_name>_requests and <queue_name>_responses.
  • Publish messages to the _requests queue.
  • Receive responses from the _responses queue.
  • Message serialization and deserialization with serde.
  • Automatic message acknowledgment.

Installation

To include this crate in your project, add it to your Cargo.toml:

[dependencies]
rabbitmq_servicess = "0.1.3"

Then, run cargo build to download and compile the crate.

Usage

Below is a basic example of how to use the RabbitMQService in your application.

Example

use rabbitmq_servicess::RabbitMQService;
use tokio;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a new RabbitMQ service connected to your RabbitMQ server
    let service = RabbitMQService::new("amqp://localhost", "my_queue").await?;

    // Send a message to the requests queue
    service.send_message_request("my_queue", "Hello, RabbitMQ!".into()).await?;

    // Wait for a response from the responses queue
    let response = service.receive_message_response("my_queue".into()).await?;

    println!("Received response: {}", response);

    Ok(())
}

Dependencies

  • rabbit_mqr for RabbitMQ management.
  • serde and serde_json for message serialization and deserialization.
  • uuid for generating unique message IDs.
  • tokio for asynchronous runtime.

License

This project is licensed under the Apache-2.0 License.

Contributing

Contributions are welcome! Please feel free to fork the repository, make changes, and submit pull requests.

Author

Documentation

You can find the documentation for this crate on docs.rs.

Repository

The source code for this crate is available on GitHub.

Commit count: 0

cargo fmt