Expand description
§Description
This crate is a Rust implementation of the Nameko RPC protocol. It allows to create a RPC service or Rpc client in Rust that can be called from or to a Nameko microservice.
Girolle mock Nameko architecture to send request and get response, with a message-listener queue system
§Examples
§RPC Service
This example is simple service that return a string with the name of the person.
use girolle::prelude::*;
use std::vec;
#[girolle]
fn hello(s: String) -> String {
format!("Hello, {}!, by Girolle", s)
}
fn main() {
let conf: Config = Config::with_yaml_defaults("config.yml".to_string()).unwrap();
let mut services: RpcService = RpcService::new(conf, "video");
services.register(hello).start();
}
§RPC Client
This example is a simple client that call the hello function in the video service.
use girolle::prelude::*;
use std::vec;
#[tokio::main]
async fn main() {
let mut rpc_client = RpcClient::new(Config::default_config());
rpc_client.register_service("video");
let result = rpc_client.send("video", "hello", Payload::new().arg("Girolle")).unwrap();
}
Re-exports§
pub use serde_json;
Modules§
- nameko_
utils - prelude
- This module contains the most commonly used types, functions and macros.
- types
Macros§
- json
- Construct a
serde_json::Value
from a JSON literal.
Structs§
- Config
- Config
- Payload
- RpcClient
- RpcClient
- RpcService
- RpcService
- RpcTask
- RpcTask
Enums§
- Girolle
Error - Value
- Represents any valid JSON value.