name: postgresql-simple-queue version: 0.2.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_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. homepage: https://github.com/jfischoff/postgresql-queue#readme license: BSD3 license-file: LICENSE author: Jonathan Fischoff maintainer: jonathangfischoff@gmail.com copyright: 2017 Jonathan Fischoff category: Web build-type: Simple extra-source-files: README.md cabal-version: >=1.10 library hs-source-dirs: src exposed-modules: Database.PostgreSQL.Simple.Queue , Database.PostgreSQL.Simple.Queue.Examples.EmailQueue , Database.PostgreSQL.Simple.Queue.Migrate , Database.PostgreSQL.Simple.Queue.Main build-depends: base >= 4.7 && < 5 , postgresql-simple , pg-transact , aeson , time , uuid , transformers , random , text , monad-control , postgresql-simple-opts , resource-pool , optparse-generic >= 1.2.1 , data-default , monad-control , lifted-base , lifted-async , exceptions , bytestring default-language: Haskell2010 ghc-options: -Wall -Wno-unused-do-bind executable async-email-example hs-source-dirs: examples main-is: EmailQueue.hs ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: base , postgresql-simple-queue , amazonka , amazonka-ses , lens , text , aeson , lifted-base default-language: Haskell2010 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 , postgresql-simple-queue , hspec , hspec-discover , postgresql-simple , pg-transact , bytestring , aeson , hspec-expectations-lifted , hspec-pg-transact , async ghc-options: -Wall -Wno-unused-do-bind -O2 -threaded -rtsopts -with-rtsopts=-N default-language: Haskell2010 source-repository head type: git location: https://github.com/jfischoff/postgresql-queue