rukko

Crates.iorukko
lib.rsrukko
version0.1.1
created_at2025-07-28 10:09:36.710853+00
updated_at2025-11-18 11:36:49.151425+00
descriptionA Rust library for communicating with JVM-based Pekko actors
homepage
repositoryhttps://github.com/hallyhaa/rukko
max_upload_size
id1770955
size194,615
Hallvard Ystad (hallyhaa)

documentation

README

Rukko

A rust library for communicating with Apache Pekko JVM actors. Allows rust applications to send messages to and receive replies from Pekko actors.

Quick Start

Add Rukko to your Cargo.toml:

[dependencies]
rukko = "0.1.0"
tokio = "1.47.0"

Basic Example

use rukko::{ActorSystem, Message};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    
    // Create an actor system
    let system = ActorSystem::new("RustClient").await?;
    
    // Connect to a remote Pekko actor
    let remote_actor = system
        .actor_selection("pekko://MySystem@127.0.0.1:25552/user/myActor")
        .await?;

    // Send a fire-and-forget message (tell pattern)
    remote_actor.tell(Message::text("One-way message"));

    // Send a message and wait for its response (ask pattern)
    let response = remote_actor
        .ask(Message::text("Hello from Rust!"))
        .await?;
    
    println!("Response: {:?}", response);
    
    system.shutdown().await;
    Ok(())
}

Configuration

Timeouts

If your actor path is wrong or something else makes an ask hang until timeout, you will be waiting for 30 seconds for your error. If you can't wait half a minute, set your own timeout like this:

use tokio::time::Duration;                                                                                                                                                                                                                                                 
...

// Default timeout (30 seconds)
let response = actor.ask(message).await?;

// Custom timeout
let response = actor
    .ask_with_timeout(important_question, Duration::from_secs(1))
    .await?;

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit issues and PRs.

Commit count: 0

cargo fmt