JoobQ is a fast, efficient asynchronous reliable job queue scheduler library processing. Jobs are submitted to a job queue, where they reside until they are able to be scheduled to run in a compute environment.
Features:
- Priority queues based on number of workers
- Reliable queue
- Error Handling
- Retry Jobs with automatic Delays
- Cron Like Periodic Jobs
- Delayed Jobs
- Stop execution of workers
- [] Expiring Jobs: Jobs to expire after certain time
- [] Rest API: Rest api to schedule jobs
- [] Approve Queue?: Jobs have to manually approved to execute
- [] Job Locking / Disable Concurrent Execution (1 Job Per Instance)
- [] Throttle (Rate limit)
- [] CLI to manage queues and monitor server
dependencies:
joobq:
github: eliasjpr/joobq
Then run:
shards install
module JoobQ
# Each worker job capacity
workers_capacity = 1
# Define Queues
QUEUES = { "queue:email" => Queue(EmailJob).new("queue:email", 10)}
# Define recurring jobs
scheduler.define do
at("5 4 * * *") { Somejob.perform }
end
end
struct EmailJob
include JoobQ::Job
@queue = "default" # Name of the queue to be processed by
@retries : Int32 = 0 # Number Of Retries for this job
# Define initializers as normal with or without named tuple arguments
def initialize(email_address : String)
end
def perform
# Logic to handle job execution
end
end
# Perform Job
EmailJob.perform(email_address: "john.doe@example.com")
EmailJob.perform(within: 1.hour, email_address: "john.doe@example.com")
TODO: Define how JoobQ can be used outside of Crystal another language
- Fork it (https://github.com/your-github-user/joobq/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Elias J. Perez - creator and maintainer