Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sepp-rs

sepp-rs

The official Rust client for sepp,
a small, language-agnostic durable job queue.

CI crates.io docs.rs license

API docs · sepp docs · Protocol · Issues

Functionality

  • Producers — enqueue jobs one at a time, in best-effort batches, or atomically. Supports idempotency keys, priorities, scheduled delivery and custom metadata.
  • Consumers — a high-level Worker runs the whole reserve → process → ack loop for you with bounded concurrency, automatic lease extension and graceful shutdown, or drop down to the raw reserve / ack / nack / extend calls for full control.
  • Observability — with the default opentelemetry feature, the client emits tracing spans and metrics and propagates W3C trace context from the producer's enqueue span to the worker's process span. The host application owns the exporter.
  • Typed errors — deterministic server rejections (payload too large, unknown queue, …) are separate from transient transport errors, so retry logic stays simple.

The client is async-only and requires a tokio runtime.

Install

cargo add sepp-rs

Quickstart

Enqueue a job, then run a worker that processes it (requires a running sepp server):

use std::time::Duration;
use sepp_rs::client::SeppClient;
use sepp_rs::worker::Worker;
use sepp_rs::{EnqueueRequest, Payload};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = SeppClient::connect("http://127.0.0.1:50051").await?;

    // Producer: enqueue a job onto the `emails` queue.
    let ack = client
        .enqueue(
            EnqueueRequest::new("emails", "send_welcome")?
                .with_payload(Payload::new(b"{\"user\":42}".to_vec(), "application/json")),
        )
        .await?;
    println!("enqueued job {}", ack.job_id);

    // Consumer: process `send_welcome` jobs from the `emails` queue. A handler
    // returns `Ok(())` to ack the job, or a `HandlerError` to nack it.
    Worker::new(client, ["emails"], Duration::from_secs(30))?
        .handle("send_welcome", |payload, ctx| async move {
            println!("processing job {}", ctx.id);
            Ok(())
        })?
        .run()
        .await;

    Ok(())
}

Runnable versions live in examples/, including traced.rs which wires up an OTLP exporter for end-to-end distributed tracing.

Feature flags

  • opentelemetry (default) — OpenTelemetry-compatible tracing spans, metrics and automatic trace context propagation.
  • tls — TLS for the gRPC transport.

Docs

The full API reference is on docs.rs. For running and configuring the sepp server itself, see the sepp docs site.

License

sepp-rs is licensed under the MIT License. See LICENSE for details.

About

Rust client for the sepp job queue

Topics

Resources

Stars

Watchers

Forks

Releases

Used by

Contributors

Languages