About
A job is a row written in the transaction that made the work owed, claimed by a runner under a lease, run outside every transaction, retried with backoff, and finished once however often it was attempted.
It runs over Rowtype's Postgres backend and names no driver. Runners in several processes claim from one queue without waiting on each other.
Install
From Hypha's opam repository, on OCaml 5.5 or later:
opam repo add hypha https://github.com/hyphatech/opam-repository.git
opam install spoolThen in your dune file:
(libraries spool rowtype-postgres eio_main)In code
A kind: its name, its payload's Wiretype description and its queue. Enqueued in the caller's transaction.
let receipt = Spool.Kind.make ~queue:"mail" ~timeout:Mtime.Span.min "receipt.send" order (* in the caller's transaction, through its own connection *) Spool.enqueue conn ~now ~unique:order_id receipt order_idA runner, with two workers on the mail queue.
let runner = Spool.Runner.create ~sw ~net ~mono_clock ~now ~queues:[ ("mail", 2) ] [ Spool.handle receipt (fun _job order_id -> send_receipt order_id) ] conninfo in Spool.Runner.start runner
Ontology
- EventQueuewaits in
- QueueJobfeeds
- ScheduleJobstarts
- JobStatementruns
Build with Hypha.
Talk to us
Bring a product or an idea.
Read the code
The components are open: source, tests and documentation.
Read the principles
The argument in full, in seven propositions.
