hasql postgres queue
Go to file
2020-07-06 16:26:35 -07:00
benchmarks Remove dequeued count and use durability config for benchmark #99 #32 (#101) 2020-07-05 20:32:02 -07:00
flamecharts flamecharts 2020-06-18 22:24:33 -07:00
hasql-queue-tmp-db hasql-queue-tmp-db (#80) 2020-06-23 04:36:33 -07:00
s Batch Interface #5 (#42) 2020-03-14 17:27:10 -07:00
src/Hasql/Queue Better partial index #104 (#105) 2020-07-06 16:26:35 -07:00
test Escape the channel name using functions #100 (#102) 2020-07-05 20:30:44 -07:00
.gitignore No NOTIFY api #6 (#17) 2020-02-15 17:59:05 -08:00
.travis.yml use postgresql-libpq-notify #73 (#74) 2020-06-13 23:08:09 -07:00
cabal.project use postgresql-libpq-notify #73 (#74) 2020-06-13 23:08:09 -07:00
CHANGELOG.md Better partial index #104 (#105) 2020-07-06 16:26:35 -07:00
developer_notes.md use postgresql-libpq-notify #73 (#74) 2020-06-13 23:08:09 -07:00
hasql-queue.cabal bump version 2020-07-06 15:30:35 -07:00
LICENSE update copyright 2020-06-13 23:10:10 -07:00
package.yaml Better partial index #104 (#105) 2020-07-06 16:26:35 -07:00
README.md update README 2020-07-05 22:38:14 -07:00
Setup.hs first commit 2017-06-13 22:22:20 -04:00
stack.yaml Rebuild cabal and remove allow-newer from stack.yaml 2020-07-05 22:32:33 -07:00
stack.yaml.lock Add IO interface benchmark option and update lts (#75) 2020-06-14 15:24:40 -07:00
Vagrantfile Remove dequeued count and use durability config for benchmark #99 #32 (#101) 2020-07-05 20:32:02 -07:00

Travis CI Status

hasql-queue

This module utilizes PostgreSQL to implement a durable queue for efficently processing payloads.

Typically a producer would enqueue a new payload as part of larger database transaction

createAccount userRecord = transaction Serializable Write $ do
  createUser userRecord
  enqueue "queue_channel" emailEncoder [makeVerificationEmail userRecord]

In another thread or process the consumer would drain the queue.

  -- Wait for a single new record and try to send the email 5 times for giving
  -- up and marking the payload as failed.
  forever $ withDequeue "queue_channel" conn emailDecoder 5 1 $
    mapM_ sendEmail