Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tqwewe/kameo
Fault-tolerant Async Actors Built on Tokio
https://github.com/tqwewe/kameo
actors tokio
Last synced: 9 days ago
JSON representation
Fault-tolerant Async Actors Built on Tokio
- Host: GitHub
- URL: https://github.com/tqwewe/kameo
- Owner: tqwewe
- License: apache-2.0
- Created: 2024-03-29T14:57:41.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-08-14T06:08:41.000Z (about 1 month ago)
- Last Synced: 2024-08-19T13:15:24.301Z (about 1 month ago)
- Topics: actors, tokio
- Language: Rust
- Homepage: https://crates.io/crates/kameo
- Size: 215 KB
- Stars: 148
- Watchers: 6
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-rust - tqwewe/kameo - Fault-tolerant Async Actors Built on Tokio (Libraries / Asynchronous)
- trackawesomelist - tqwewe/kameo (⭐284) - Fault-tolerant Async Actors Built on Tokio (Recently Updated / [Sep 15, 2024](/content/2024/09/15/README.md))
README
# Kameo 🎬
![Crates.io Version](https://img.shields.io/crates/v/kameo)
![Crates.io Total Downloads](https://img.shields.io/crates/d/kameo)
![Crates.io License](https://img.shields.io/crates/l/kameo)
![GitHub Repo stars](https://img.shields.io/github/stars/tqwewe/kameo)![Kameo banner image](https://github.com/tqwewe/kameo/blob/main/banner.png?raw=true)
## What is Kameo
Kameo is a Rust library to build fault-tolerant async actors in Rust.
## Feature highlights
* Async Rust: tokio task per actor
* Supervision: link actors together
* Remote messaging: message actors between nodes
* Panic safe: gracefully handled panics
* Back pressure: supports bounded & unbounded mpsc messaging## Reasons to use Kameo
* **Distributed Systems**: Use Kameo when building distributed systems that require seamless communication between actors across multiple nodes, leveraging its built-in support for remote actor messaging and registration.
* **Concurrency with Simplicity**: Choose Kameo for projects that need efficient concurrency management without the complexity of manually handling threads, as it provides a straightforward API for spawning and managing actors with Tokio.
* **Scalability**: Kameo is ideal for applications that need to scale horizontally, thanks to its actor pools and remote actor support, making it easy to scale workloads across multiple machines.# Getting Started
Add kameo as a dependency to your crate.
```bash
cargo add kameo
```Define an actor and some messages.
```rust
use kameo::Actor;
use kameo::message::{Context, Message};
use kameo::request::MessageSend;#[derive(Actor)]
struct Counter {
count: i64,
}struct Inc { amount: u32 }
impl Message for Counter {
type Reply = i64;async fn handle(&mut self, msg: Counter, _ctx: Context<'_, Self, Self::Reply>) -> Self::Reply {
self.count += msg.0 as i64;
self.count
}
}
```Spawn and message the actor.
```rust
let actor_ref = kameo::spawn(Counter { count: 0 });
let count = actor_ref.ask(Inc { amount: 42 }).send().await?;
assert_eq!(count, 42);
```## Benchmarks
**13x higher throughput when compared with Actix**
![benchmark](https://github.com/tqwewe/kameo/raw/main/benchmark.svg)
Above shows a basic benchmark for sending a message to an actor in Kameo and Actix.
Always benchmark for yourself.## Contributing
Contributions are welcome! Feel free to submit pull requests, create issues, or suggest improvements.
## License
`kameo` is dual-licensed under either:
- MIT License ([LICENSE-MIT](LICENSE-MIT) or )
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or )at your option.