#microservices #rpc-framework #amqp #protobuf #handler #lapin #built

kanin

An RPC microservice framework for AMQP, protobuf and Rust built on lapin (https://github.com/amqp-rs/lapin)

27 releases (breaking)

0.32.1 Apr 24, 2024
0.31.0 Mar 25, 2024
0.26.0 Oct 24, 2023
0.22.2 Apr 18, 2023
0.17.0 Jul 25, 2022

#1095 in Network programming

Download history 291/week @ 2024-06-10 193/week @ 2024-06-17 90/week @ 2024-06-24 53/week @ 2024-07-01 36/week @ 2024-07-08 109/week @ 2024-07-15 11/week @ 2024-07-22 77/week @ 2024-07-29 7/week @ 2024-08-05 58/week @ 2024-08-12 74/week @ 2024-08-19 122/week @ 2024-08-26 74/week @ 2024-09-02 78/week @ 2024-09-09 36/week @ 2024-09-16 90/week @ 2024-09-23

278 downloads per month

MIT/Apache

81KB
1.5K SLoC

🐰 kanin

Crates.io version Documentation status

A framework for AMQP built on top of lapin that makes it easy to create RPC microservices in Rust 🦀, using Protobuf.

Usage

Run cargo add kanin to add kanin to your Cargo.toml.

mod protobuf;

use kanin::{extract::Msg, App};
use protobuf::echo::{EchoRequest, EchoResponse};

async fn echo(Msg(request): Msg<EchoRequest>) -> EchoResponse {
    EchoResponse::success(request.value)
}

#[tokio::main]
async fn main() -> kanin::Result<()> {
    App::new(())
        .handler("my_routing_key", echo)
        .run("amqp_addr")
        .await
}

See the documentation for examples and more specific usage, or see the /minimal_example folder in this repo.

Testing

To run tests, install just and Docker (you need docker-compose).

Then, simply run just test, which will launch a RabbitMQ instance in a container that the tests will connect to.

Dependencies

~11–23MB
~356K SLoC