24 releases

0.11.0 Dec 9, 2021
0.10.1 Nov 22, 2021
0.10.0 Oct 27, 2021
0.9.1 Apr 5, 2021
0.1.3 Jun 5, 2016

#44 in Database interfaces

Download history 831/week @ 2021-10-01 874/week @ 2021-10-08 1050/week @ 2021-10-15 1103/week @ 2021-10-22 1122/week @ 2021-10-29 1134/week @ 2021-11-05 1294/week @ 2021-11-12 1023/week @ 2021-11-19 880/week @ 2021-11-26 743/week @ 2021-12-03 642/week @ 2021-12-10 517/week @ 2021-12-17 302/week @ 2021-12-24 217/week @ 2021-12-31 277/week @ 2022-01-07 458/week @ 2022-01-14

1,338 downloads per month
Used in maman

MIT license

14KB
242 lines

Rust Sidekiq Client

Sidekiq client allowing to push jobs. Using the Sidekiq job format as reference.

Dependencies

Installation

[dependencies]
sidekiq = "0.10"

Default environment variables

  • REDIS_URL="redis://127.0.0.1/"

Used by

Examples

use sidekiq::{Job, Value};
use sidekiq::{Client, ClientOpts, create_redis_pool};
use time::{OffsetDateTime, Duration};

let ns = "test";
let client_opts = ClientOpts {
    namespace: Some(ns.to_string()),
    ..Default::default()
};
let pool = create_redis_pool().unwrap();
let client = Client::new(pool, client_opts);
let class = "MyClass".to_string();

// basic job
let job = Job::new(class, vec![sidekiq::Value::Null], Default::default());
match client.push(job) {
    Ok(_) => {},
    Err(err) => {
        println!("Sidekiq push failed: {}", err);
    },
}

// scheduled-jobs (perform_in)
let job = Job::new(class, vec![sidekiq::Value::Null], Default::default());
let interval = Duration::hours(1);
match client.perform_in(interval, job) {
    Ok(_) => {},
    Err(err) => {
        println!("Sidekiq push failed: {}", err);
    },
}

// scheduled-jobs (perform_at)
let job = Job::new(class, vec![sidekiq::Value::Null], Default::default());
let start_at = OffsetDateTime::now_utc().checked_add(Duration::HOUR).unwrap();
match client.perform_at(start_at, job) {
    Ok(_) => {},
    Err(err) => {
        println!("Sidekiq push failed: {}", err);
    },
}

REFERENCES

LICENSE

The MIT License

Copyright (c) 2016-2021 Laurent Arnoud laurent@spkdev.net


Build Version Documentation License Dependency status

Dependencies

~6MB
~137K SLoC