Popularity
6.6
Stable
Activity
0.0
Stable
16
5
3
Monthly Downloads: 15
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags:
Web
PostgreSQL
postgresql-simple-queue alternatives and similar packages
Based on the "postgresql" category.
Alternatively, view postgresql-simple-queue alternatives based on common mentions on social networks and blogs.
-
postgresql-named
Deserialize PostgreSQL rows to Haskell records by matching column names and record field names
Do you think we are missing an alternative of postgresql-simple-queue or a related project?
README
postgresql-simple-queue
This module utilizes 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 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 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
Installation
stack install postgresql-simple-queue
Blog
This package was discussed in the blog Testing PostgreSQL for Fun