postgresql-simple-queue: A PostgreSQL backed queue
This module utilize PostgreSQL to implement a durable queue for efficently processing arbitrary payloads which can be represented as JSON.
Typically a producer would enqueue a new payload as part of larger database transaction
createAccount userRecord = do
'runDBTSerializable' $ do
createUserDB userRecord
'enqueueDB' $ makeVerificationEmail userRecordIn another thread or process, the consumer would drain the queue.
forever $ do
-- Attempt get a payload or block until one is available
payload <- 'lock' conn
-- Perform application specifc parsing of the payload value
case fromJSON $ 'pValue' payload of
Success x -> sendEmail x -- Perform application specific processing
Error err -> logErr err
-- Remove the payload from future processing
'dequeue' conn $ 'pId' payload
[Skip to Readme]
Modules
- Database
- PostgreSQL
- Simple
- Database.PostgreSQL.Simple.Queue
- Examples
- Database.PostgreSQL.Simple.Queue.Examples.EmailQueue
- Database.PostgreSQL.Simple.Queue.Main
- Database.PostgreSQL.Simple.Queue.Migrate
- Examples
- Database.PostgreSQL.Simple.Queue
- Simple
- PostgreSQL
Downloads
- postgresql-simple-queue-0.1.0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1.0.0, 0.1.0.1, 0.2.0.0, 0.2.1.0, 0.3.0.0, 0.4.0.0, 0.5.0.0, 0.5.0.1, 0.5.1.0, 0.5.1.1, 1.0.0, 1.0.1 |
|---|---|
| Dependencies | aeson, amazonka, amazonka-ses, base (>=4.7 && <5), bytestring, data-default, exceptions, lens, lifted-async, lifted-base, monad-control, optparse-generic, pg-transact, postgresql-simple, postgresql-simple-opts, postgresql-simple-queue, random, resource-pool, text, time, transformers, uuid [details] |
| License | BSD-3-Clause |
| Copyright | 2017 Jonathan Fischoff |
| Author | Jonathan Fischoff |
| Maintainer | jonathangfischoff@gmail.com |
| Uploaded | by JonathanFischoff at 2017-06-17T05:07:38Z |
| Category | Web |
| Home page | https://github.com/jfischoff/postgresql-queue#readme |
| Source repo | head: git clone https://github.com/jfischoff/postgresql-queue |
| Distributions | |
| Reverse Dependencies | 1 direct, 0 indirect [details] |
| Executables | async-email-example |
| Downloads | 7642 total (34 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs not available [build log] All reported builds failed as of 2017-06-17 [all 3 reports] |