4 releases

0.3.0 Feb 12, 2023
0.2.2 Nov 27, 2022
0.2.1 Jul 14, 2021
0.2.0 Feb 2, 2021

#12 in #amqp-client


Used in 2 crates

Apache-2.0

74KB
2K SLoC

MetalMQ

Crates.io Build Status

Build and run

metalmq is under development, it is not feature complete but you can try and run with cargo run.

cargo run --bin metalmq
## or to enable logs
RUST_LOG=debug cargo run --bin metalmq
RUST_LOG=metalmq=trace cargo run --bin metalmq
cargo test --tests

## or to run integration tests
cargo test --package metalmq --test it

There are some examples in the examples directory, they implement simple scenarios of the metalmq-client library. To run execute

RUST_LOG=metalmq_client=trace cargo run --example publish-consume

Running tests in metalmq-client

cargo test --package metalmq-client --test it

AMQP compliance

For AMQP compliance we use pika Python library and pytest framework to be to validate the comformance of metalmq server.

cd amqp-compliance
pytest

Compilance matrix

Method Field
connection.
channel.
exchange.declare ✅ exchange
❌ type
✅ passive
❌ durable (no persistence)
❓ arguments
queue.declare ✅ queue
✅ passive
❓ durable
✅ exclusive
✅ auto-delete
basic.ack

AMQP 0.9 client library

In metalmq-client there is a Rust async client which implements part of the AMQP 0.9.1 protocol. You can try agains metalmq server or rabbitmq.

#docker run -p 5672:5672 -p 15672:15672 --rm rabbitmq:3-management
cargo test --lib metalmq-client

In order to validate AMQP packages we also need a stable AMQP client implementation which is the pika. It runs on Python, so one need to install pipenv to run that.

cd amqp-compliance
pytest

Unit test coverage

Run unit test with coverage.

rustup component add llvm-tools-preview
cargo install grconv

mkdir -p target/coverage/data
make metalmq-cover
open target/coverage/html/index.html

Use tokio console

In the examples the publish-consume test has dependency on the tokio console.

RUSTFLAGS="--cfg tokio_unstable" cargo run --example publish-consume

lib.rs:

Data structures and converter functions for dealing with AMQP frames.

All the data types are in the frame module, the codec implements the encoding and the decoding.

Dependencies

~3.5–5MB
~79K SLoC