Skip to content

Norio4/rust-sidekiq

 
 

Repository files navigation

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 chrono::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);
    },
}

REFERENCES

LICENSE

The MIT License

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


Build Version Documentation License Dependency status

About

Rust Sidekiq Client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%