All Projects → CleverCloud → Lapin

CleverCloud / Lapin

Licence: mit
AMQP client library in Rust, with a clean, futures based API

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Lapin

Yii2 Queue
Yii2 Queue Extension. Supports DB, Redis, RabbitMQ, Beanstalk and Gearman
Stars: ✭ 977 (+96.58%)
Mutual labels:  hacktoberfest, async, amqp
azure-service-bus-dotnet-plugins
☁️ Plugins for the .NET Standard client library for Azure Service Bus
Stars: ✭ 15 (-96.98%)
Mutual labels:  amqp, messaging
qpid-proton-j
Mirror of Apache Qpid Proton-J
Stars: ✭ 28 (-94.37%)
Mutual labels:  amqp, messaging
Aws
AWS SDK with readable code and async responses
Stars: ✭ 268 (-46.08%)
Mutual labels:  hacktoberfest, async
azure-event-hubs-go
Golang client library for Azure Event Hubs https://azure.microsoft.com/services/event-hubs
Stars: ✭ 80 (-83.9%)
Mutual labels:  amqp, messaging
amq-examples
This repository contains a set of examples to be used with Red Hat AMQ messaging suite components.
Stars: ✭ 25 (-94.97%)
Mutual labels:  amqp, messaging
Promise Pool
Map-like, concurrent promise processing
Stars: ✭ 258 (-48.09%)
Mutual labels:  hacktoberfest, async
qpid-python
Mirror of Apache Qpid Python
Stars: ✭ 15 (-96.98%)
Mutual labels:  amqp, messaging
Service Bus
PHP Service Bus (publish-subscribe pattern) implementation
Stars: ✭ 290 (-41.65%)
Mutual labels:  async, messaging
Gitui
Blazing 💥 fast terminal-ui for git written in rust 🦀
Stars: ✭ 6,762 (+1260.56%)
Mutual labels:  hacktoberfest, async
Ava
Node.js test runner that lets you develop with confidence 🚀
Stars: ✭ 19,458 (+3815.09%)
Mutual labels:  hacktoberfest, async
azure-event-hubs-java
☁️ Java client library for Azure Event Hubs
Stars: ✭ 49 (-90.14%)
Mutual labels:  amqp, messaging
azure-service-bus-go
Golang library for Azure Service Bus -- https://aka.ms/azsb
Stars: ✭ 67 (-86.52%)
Mutual labels:  amqp, messaging
qpid-dispatch
Mirror of Apache Qpid Dispatch
Stars: ✭ 62 (-87.53%)
Mutual labels:  amqp, messaging
gobroker
golang wrapper for all (to-be) kinds of message brokers
Stars: ✭ 15 (-96.98%)
Mutual labels:  amqp, messaging
qpid-jms
Mirror of Apache Qpid JMS
Stars: ✭ 60 (-87.93%)
Mutual labels:  amqp, messaging
Servicebus
Simple service bus for sending events between processes using amqp.
Stars: ✭ 415 (-16.5%)
Mutual labels:  messaging, amqp
qpid-cpp
Mirror of Apache Qpid C++
Stars: ✭ 77 (-84.51%)
Mutual labels:  amqp, messaging
qpid-broker-j
Mirror of Apache Qpid Broker-J
Stars: ✭ 52 (-89.54%)
Mutual labels:  amqp, messaging
Aiologger
Asynchronous logging for python and asyncio
Stars: ✭ 284 (-42.86%)
Mutual labels:  hacktoberfest, async

API Docs Build status Downloads Coverage Status Dependency Status LICENSE

A Rust AMQP client library.

This project follows the AMQP 0.9.1 specifications, targeting especially RabbitMQ.

Feature switches

  • codegen: generate code instead of using pregenerated one
  • native-tls (default): enable amqps support through native-tls
  • openssl: enable amqps support through openssl (preferred over native-tls when set)
  • rustls: enable amqps support through rustls (preferred over openssl when set, uses rustls-native-certs by default)
  • rustls-native-certs: same as rustls, be ensure we'll still use rustls-native-certs even if the default for rustls changes
  • rustls-webpki-roots-certs: same as rustls but using webkit-roots instead of rustls-native-certs

Integration with async-io

Integration with async-io is provided by the async-lapin crate.

Integration with async-std

Integration with async-std is provided by the async-amqp crate.

Integration with bastion

Integration with bastion is provided by the bastion-amqp crate.

Integration with smol

Integration with smol is provided by the lapinou crate.

Integration with tokio

Integration with tokio is provided by the tokio-amqp crate.

Example

use futures_lite::stream::StreamExt;
use lapin::{
    options::*, publisher_confirm::Confirmation, types::FieldTable, BasicProperties, Connection,
    ConnectionProperties, Result,
};
use tracing::info;

fn main() -> Result<()> {
    if std::env::var("RUST_LOG").is_err() {
        std::env::set_var("RUST_LOG", "info");
    }

    tracing_subscriber::fmt::init();

    let addr = std::env::var("AMQP_ADDR").unwrap_or_else(|_| "amqp://127.0.0.1:5672/%2f".into());

    async_global_executor::block_on(async {
        let conn = Connection::connect(
            &addr,
            ConnectionProperties::default(),
        )
        .await?;

        info!("CONNECTED");

        let channel_a = conn.create_channel().await?;
        let channel_b = conn.create_channel().await?;

        let queue = channel_a
            .queue_declare(
                "hello",
                QueueDeclareOptions::default(),
                FieldTable::default(),
            )
            .await?;

        info!(?queue, "Declared queue");

        let mut consumer = channel_b
            .basic_consume(
                "hello",
                "my_consumer",
                BasicConsumeOptions::default(),
                FieldTable::default(),
            )
            .await?;
        async_global_executor::spawn(async move {
            info!("will consume");
            while let Some(delivery) = consumer.next().await {
                let delivery = delivery.expect("error in consumer");
                delivery
                    .ack(BasicAckOptions::default())
                    .await
                    .expect("ack");
            }
        }).detach();

        let payload = b"Hello world!";

        loop {
            let confirm = channel_a
                .basic_publish(
                    "",
                    "hello",
                    BasicPublishOptions::default(),
                    payload.to_vec(),
                    BasicProperties::default(),
                )
                .await?
                .await?;
            assert_eq!(confirm, Confirmation::NotRequested);
        }
    })
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].