Home

Awesome

Humming - queue_classic in Haskell

Humming implements job queues and time-based job scheduling in Haskell on top of PostgreSQL. The job queue is a port of the Ruby queue_classic library.

This package also provides a humming command-line program to interact with queue_classic or Humming.

Overview

Humming essentially manages two PostgreSQL tables: one for the queues, and one for the scheduled jobs.

Jobs can be pushed to (or retrieved from) Humming using any programming language that can talk to PostgreSQL. In particular, you can use this library in Haskell, queue_classic in Ruby, or Pueuey in Python.

Jobs are scheduled by writing to the scheduled jobs table. Moving scheduled jobs to Humming queues is done by running the humming schedule process.

Example usage

A humming executable is provided.

> export DB='postgres://username:password@localhost/database'
> humming create  --database-url $DB
> humming drop    --database-url $DB
> humming enqueue --database-url $DB \
    --queue FOO --method play --arguments '{}'
> humming count   --database-url $DB [--queue FOO]
> humming delete  --database-url $DB --job 4
> humming lock    --database-url $DB --queue FOO
> humming work    --database-url $DB --queue FOO

> humming schedule --database-url $DB [--queue FOO]

humming schedule push endlessly scheduled jobs to their respective queues. It is possible to take care of only jobs destined to a specific queue with the --queue option. It is safe to run multiple humming schedule processes (possibly on different hosts).

Instead of a --database-url option, it is possible to use the HUMMING_CONNECTION_STRING environment variable.

Tests

Tests can be run withing GHCi with the runTests function.

Limitations