homepage: https://github.com/jfischoff/postgresql-queue#readme
changelog-type: markdown
hash: 30bd4f9da63d2a609e62753bd10d72e0e37209510d9baa7c9b1af73b08608fed
test-bench-deps:
  exceptions: -any
  hasql: -any
  cryptohash-sha1: -any
  bytestring: -any
  tmp-postgres: -any
  here: -any
  split: -any
  stm: -any
  base: '>=4.7 && <5'
  time: -any
  base64-bytestring: -any
  hspec: -any
  text: -any
  hspec-core: -any
  monad-control: -any
  resource-pool: -any
  async: -any
  hasql-notifications: -any
  hspec-expectations-lifted: -any
  transformers: -any
  random: -any
  hasql-queue: -any
  aeson: -any
maintainer: jonathangfischoff@gmail.com
synopsis: A PostgreSQL backed queue
changelog: |
  Changelog for hasql-queue
  - 1.0.0.0
    - First release!
basic-deps:
  exceptions: -any
  hasql: -any
  cryptohash-sha1: -any
  bytestring: -any
  tmp-postgres: -any
  here: -any
  stm: -any
  base: '>=4.7 && <5'
  time: -any
  base64-bytestring: -any
  text: -any
  monad-control: -any
  resource-pool: -any
  async: -any
  hasql-notifications: -any
  transformers: -any
  random: -any
  hasql-queue: -any
  aeson: -any
all-versions:
- 1.0.1
author: Jonathan Fischoff
latest: 1.0.1
description-type: markdown
description: |
  [![Travis CI Status](https://travis-ci.org/jfischoff/hasql-queue.svg?branch=master)](http://travis-ci.org/jfischoff/hasql-queue)

  # 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

  ```haskell
  createAccount userRecord = transaction Serializable Write $ do
    createUser userRecord
    enqueueNotification "queue_channel" emailEncoder [makeVerificationEmail userRecord]
  ```

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

  ```haskell
    -- 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
  ```

  In the example above we used the `Session` API for enqueuing and the `IO` for
  dequeuing.

  The `Session` API is useful for composing larger transactions and the `IO` utilizes PostgreSQL notifications to avoid polling.

  ## Installation

  ```bash
  stack install hasql-queue
  ```
license-name: BSD-3-Clause

Update from Hackage at 2020-06-14T06:17:51Z
Update from Hackage at 2020-06-14T06:17:51Z
