girolle
Description
A nameko-rpc like lib in rust. Check the To-Do section to see limitation.
Do not use in production!
Girolle use Nameko architecture to send request and get response.
Documentation
User documentation and Rust documentation
Installation
cargo add girolle
Stack
Girolle use lapin as an AMQP client/server library.
Setup
You need to set this environement variables.
- RABBITMQ_USER: The RabbitMQ user
- RABBITMQ_PASSWORD: The RabbitMQ password
- RABBITMQ_HOST: THe rabbitMQ host adress
- Optional: RABBITMQ_PORT: The RabbitMQ port (default: 5672)
How to use it
The core concept is to remove the pain of the queue creation and reply by
mokcing the Nameko architecture with a RpcService
or RpcClient
, and to
use an abstract type serde_json::Value
to manipulate a serializable data.
if you do not use the macro #[girolle]
you need to create a function that
extract the data from the a &[Value]
like this:
Exemple
Create a simple service
use *;
// Because the function is recursive, it need to be wrap in a function
Create multiple calls to service of methods, sync and async
use *;
use vec;
use ;
async
To-Do
- Handle the error
- write test
- create a proxy service in rust to interact with an other service nameko-rpc
- Add macro to simplify the creation of a service
- Add basic macro
- fix macro to handle
return
- fix macro to handle recursive function
- listen to a pub/sub queue
Limitation
The current code as been tested with the nameko and girolle examples in this repository.
nameko_test.py | simple_senders | |
---|---|---|
simple_service | x | x |
nameko_service | x | x |
simple_macro | x | x |
Benchmark
The benchmark is done to test the overhead of the macro.