Crate rtj

source · []
Expand description

rtj aims to provide a generic, robust, and secure framework for users to develop their own job execution applications. Encryption uses crypto_box and is compatible with other implementations of the standard.


// Full example avaialble in the source repo under /examples/
use rtj::{Job, Message};
    // Create a struct that implements Job
    let hello = Hello { name, age };

    // Build a Message from that struct
    let msg = Message::new()
        .set_header(MsgType::Hello, send_pub, &mut rng)?;

    // Encrypt the message payload for the recipient.
    let encrypted_to_recv = msg.encrypt(recv_secret.public_key(), send_secret)?;

    // Decrypt the message payload as the recipient.
    let hello_again = encrypted_to_recv.decrypt(recv_secret)?;

    // Verify the message type.
    if let MsgType::Hello = hello_again.header.msgtype.into() {
        // Deserialize the message payload as the correct type
        let hello = Hello::decode(&hello_again.payload);

        // Execute the runner method on the deserialized type;


Header contains identifying information about the Job that follows.

Provides a container for Header and Serialized and/or Encrypted Job payloads.


Custom errors for RTJ crate


The core trait Job providing required methods to user-defined data types for orchestrating task execution.