The latest version of postgresql-simple-queue is 1.0.1-0.
postgresql-simple-queue
Version 0.2.1.0 revision 0 uploaded by JonathanFischoff.
Package meta
- Synopsis
- A PostgreSQL backed queue
- Description
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' "queue_schema" $ makeVerificationEmail userRecord
In another thread or process, the consumer would drain the queue.
forever $ do -- Attempt get a payload or block until one is available payload <- lock "queue_schema" 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 "queue_schema" conn $ pId payload To support multiple queues in the same database, the API expects a schema name string to determine which queue tables to use.
- Author
- Jonathan Fischoff
- Bug reports
- n/a
- Category
- Web
- Copyright
- 2017 Jonathan Fischoff
- Homepage
- https://github.com/jfischoff/postgresql-queue#readme
- Maintainer
- jonathangfischoff@gmail.com
- Package URL
- n/a
- Stability
- n/a