-- This file has been generated from package.yaml by hpack version 0.17.1.
--
-- see: https://github.com/sol/hpack
name: postgresql-simple-queue
version: 1.0.0
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" 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" conn $ pId payload
>
> To support multiple queues in the same database, the API expects a table name string
> to determine which queue tables to use.
homepage: https://github.com/jfischoff/postgresql-queue#readme
bug-reports: https://github.com/jfischoff/postgresql-queue/issues
license: BSD3
license-file: LICENSE
author: Jonathan Fischoff
maintainer: jonathangfischoff@gmail.com
copyright: 2017 Jonathan Fischoff
category: Web
build-type: Simple
cabal-version: >= 1.10
extra-source-files:
README.md
source-repository head
type: git
location: https://github.com/jfischoff/postgresql-queue
library
hs-source-dirs:
src
exposed-modules:
Database.PostgreSQL.Simple.Queue
Database.PostgreSQL.Simple.Queue.Migrate
other-modules:
Paths_postgresql_simple_queue
build-depends:
base >=4.7 && <5
, time
, transformers
, random
, text
, monad-control
, exceptions
, postgresql-simple
, pg-transact
, aeson
, bytestring
, stm
default-language: Haskell2010
ghc-options: -Wall -Wno-unused-do-bind
test-suite unit-tests
type: exitcode-stdio-1.0
hs-source-dirs:
test
main-is: Spec.hs
other-modules:
Database.PostgreSQL.Simple.QueueSpec
build-depends:
base >=4.7 && <5
, time
, transformers
, random
, text
, monad-control
, exceptions
, postgresql-simple
, pg-transact
, aeson
, bytestring
, stm
, postgresql-simple-queue
, hspec
, hspec-discover
, hspec-expectations-lifted
, hspec-pg-transact
, async
, split
ghc-options: -Wall -Wno-unused-do-bind -O2 -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010