Table of Contents
Overview
BakBon is an lightweight infrastructure microkernel library in Rust created to help configure, compose and build any type of message-driven distributed system whether it is microservices, blockchain insfrastructure IoT networks, by providing generic building blocks such as routers, gateways, balancers, queues, caching systems.
Features
- Protocol-Agnostic: works with TCP, UDP, HTTP(s), gRPC, MQTT, Serial, InProc or custom protocols.
- Composable: mix and match different components (Router, Queue, Gateway, Balancer, Cache, etc).
- Type-Safe: strong typing with runtime flexibility.
- Production-Ready: Comprehensive tests, clean architecture.
Installation
cargo add bakbon
File System
📂 bakbon
│
├── 📂 src
│ │
│ ├── 📂 balancer
│ │ │
│ │ ├── 📄 mod.rs
│ │ └── 📄 strategy.rs
│ │
│ ├── 📂 cache.rs
│ │ │
│ │ ├── 📄 builder.rs
│ │ ├── 📄 eviction.rs
│ │ └── 📄 mod.rs
│ │
│ ├── 📂 core
│ │ │
│ │ ├── 📄 address.rs
│ │ ├── 📄 error.rs
│ │ ├── 📄 mod.rs
│ │ └── 📄 protocol.rs
│ │
│ ├── 📂 infra
│ │ │
│ │ ├── 📄 gateway.rs
│ │ ├── 📄 middleware.rs
│ │ ├── 📄 mod.rs
│ │ ├── 📄 processor.rs
│ │ ├── 📄 service.rs
│ │ └── 📄 storage.rs
│ │
│ ├── 📂 message
│ │ │
│ │ ├── 📄 envelope.rs
│ │ ├── 📄 mod.rs
│ │ └── 📄 route.rs
│ │
│ ├── 📂 queue
│ │ │
│ │ ├── 📂 attributes
│ │ │ │
│ │ │ ├── 📄 delivery.rs
│ │ │ ├── 📄 durability.rs
│ │ │ ├── 📄 mod.rs
│ │ │ ├── 📄 ordering.rs
│ │ │ └── 📄 provider.rs
│ │ │
│ │ ├── 📄 builder.rs
│ │ └── 📄 mod.rs
│ │
│ ├── 📂 registry
│ │ │
│ │ ├── 📄 builder.rs
│ │ └── 📄 mod.rs
│ │
│ ├── 📂 router
│ │ │
│ │ ├── 📄 builder.rs
│ │ └── 📄 mod.rs
│ │
│ └── 📄 lib.rs
│
├── 📂 tests
│ │
│ ├── 📂 common
│ │ │
│ │ ├── 📂 services
│ │ │ │
│ │ │ ├── 📄 echo.rs
│ │ │ └── 📄 mod.rs
│ │ │
│ │ ├── 📄 gateway.rs
│ │ └── 📄 mod.rs
│ │
│ ├── 📄 integration_gateway.rs
│ ├── 📄 integration_queue.rs
│ └── 📄 integration_router.rs
│
├── ⚙️ Cargo.toml
├── 🔑 LICENSE
└── 📖 README.md
14 directories, 40 files
Modules
BakBon provides:
- Balancer: Balancer.
- Cache: Cache.
- Core: Address, Protocol, Error, Result.
- Infra: Gateway, Middleware, Processor, Service and Storage traits.
- Message: Envelope, Route, Reply, Headers, Payload.
- Queue: Queue.
- Registry: Registry.
- Router: Router.
Usage
use *;
let url = "http://services.com/echo";
// Create an address from url
let address: = parse;
assert!;
// Create a service with the address
let service = new;
// Register the service while building a registry
let registry = builder
.register
.build;
// Build a router
let mut router = builder
.registry
.build;
// Create a message.
let message = new;
// Route the message to the appropriate service
let reply: = router.route;
assert!;
Attribution
If you use this project in your application, service, or research, please include the following credit:
Based on Bakbon by Xn!l0 (https://github.com/Xnil0/backlab), licensed under the MIT License.