[−][src]Crate cerk_loader_file
This is a package for CERK. CERK is an open source CloudEvents Router written in Rust with a MicroKernel architecture.
Introduction
CERK lets you route your CloudEvents between different different ports. Ports are transport layer bindings over which CloudEvents can be exchanged. It is built with modularity and portability in mind.
Components
CERK comes with a couple of prefabricated components, but implementing custom components is easy.
A good overview is provided on GitHub.
This Component: File Base Loader
The cerk_loader_file link the different modules together and pass it to the bootstrap
function.
It uses a ComponentStartLinks
file with all links to the start functions and a configuration file.
The configuration file could be passed by the env variable $CONFIG_PATH
or just use the path ./init.json
.
Example Config
{
"scheduler": "SCHEDULER",
"router": "ROUTER",
"config_loader": "CONFIG_LOADER",
"ports": {
"myport": "PORT"
}
}
Example ComponentStartLinks
#[macro_use] extern crate cerk_loader_file; use cerk_loader_file::{start, ComponentStartLinks}; fn main() { let link = ComponentStartLinks { schedulers: fn_to_links![SCHEDULER], routers: fn_to_links![ROUTER], config_loaders: fn_to_links![CONFIG_LOADER], ports: fn_to_links![PORT], }; start(link); }
Examples
Macros
fn_to_link | |
fn_to_links |
Structs
ComponentStartLinks |
Functions
load_by_path | Starts cerk with a ComponentStartLinks set and a init config provided in the given path. |
start | Starts cerk with a ComponentStartLinks set and a init config provided in path |