Skip to content

Latest commit

 

History

History
114 lines (79 loc) · 5.03 KB

README.md

File metadata and controls

114 lines (79 loc) · 5.03 KB

zeebe-rs

CI docs.rs crates.io

A Rust client and worker implementation for interacting with Camunda Zeebe built using Tonic, Tokio and Serde.

Usage

Make sure you have protoc installed. Add zeebe-rs to your Cargo.toml alongside Tokio and Serde.

serde = "1.0.217"
tokio = "1.43.0"
zeebe-rs = "0.3.1"

zeebe-rs uses the builder pattern together with type states extensively to guarantee that requests to Zeebe contain all required information. The client supports type safe conversions of data to and from Zeebe with Serde.

Example

use serde::{Deserialize, Serialize};
use std::{path::PathBuf, time::Duration};

#[derive(Debug, Serialize, Deserialize)]
struct HelloWorld {
    hello: String,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {

    //Create a client with OAuth
    let client = zeebe_rs::Client::builder()
        .with_address("http://localhost", 26500)
        .with_oauth(
            String::from("zeebe"),
            String::from("zecret"),
            String::from(
                "http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token",
            ),
            String::from("zeebe-api"),
            Duration::from_secs(30),
        )
        .build()
        .await?;

    //Block until first OAuth token has been retrieved
    let _ = client.auth_initialized().await;

    //Deploy a BPMN from file
    let result = client
        .deploy_resource()
        .with_resource_file(PathBuf::from("./examples/resources/hello_world.bpmn"))
        .read_resource_files()?
        .send()
        .await?;


    //Create a process instance
    let result = client
        .create_process_instance()
        .with_bpmn_process_id(String::from("hello_world"))
        .with_variables(HelloWorld {
            hello: String::from("world"),
        })?
        .with_result(None)
        .send_with_result::<HelloWorld>()
        .await?;

    Ok(())
}

Additional examples available in the documentation and examples folder.

Development

Built using:

  • rustc 1.83.0
  • cargo 1.85.0-nightly (4c39aaff6 2024-11-25) (fmt and clippy only)
  • protoc v29.2

Releases

This project aims to release in lockstep with new versions of Zeebe. The API should be considered unstable until version 1.0.0 is reached. There is currently no versioning schema that matches the zeebe-rs version with the Zeebe version.

Changelog

See the changelog for information on what each release contains.

Contributing

We welcome contributions from the community, see our contribution guidelines.

Attributions

This library draws heavily from pyzeebe, zeebest and zeebe-rust. We comply with their licensing terms and acknowledge their significant contributions. Some portions of this library include adapted code or ideas from these projects. Any modifications made are in compliance with the original licensing terms.

We are deeply grateful to the maintainers and contributors of these projects for their invaluable efforts in advancing the open-source community. We encourage developers to explore these projects for more insights into working with the Zeebe workflow engine.

License

Copyright (c) 2025 Tim Henriksson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.