haskell-bee-pgmq: PostgreSQL/PGMQ broker implementation for haskell-bee

[ agpl, concurrency, library, program ] [ Propose Tags ] [ Report a vulnerability ]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Dependencies aeson (>=2.1 && <2.3), base (>=4.17.2.0 && <5), bytestring (>=0.11 && <0.13), containers (>=0.6.7 && <0.8), deepseq (>=1.0.0.0 && <1.7), haskell-bee (>=0.1.0.0 && <0.2), haskell-bee-pgmq, haskell-pgmq (>=0.1.0.0 && <0.2), mtl (>=2.2 && <2.4), postgresql-libpq (>=0.10 && <=0.11), postgresql-simple (>=0.6 && <0.8), safe (>=0.3 && <0.4), safe-exceptions (>=0.1.7 && <0.2), scientific (>=0.3.7.0 && <0.4), text (>=1.2 && <2.2), time (>=1.10 && <1.15), units (>=2.4 && <2.5), unix-time (>=0.4.11 && <0.5) [details]
License AGPL-3.0-or-later
Author Gargantext
Maintainer gargantext@iscpif.fr
Category Concurrency
Home page https://gitlab.iscpif.fr/gargantext/haskell-bee
Uploaded by cgenie at 2025-06-16T11:05:29Z
Distributions
Executables simple-worker
Downloads 2 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for haskell-bee-pgmq-0.1.0.0

[back to package description]

haskell-bee-pgmq

PostgreSQL/PGMQ broker implementation for haskell-bee.

This package provides a PostgreSQL-backed message queue broker using PGMQ (PostgreSQL Message Queue).

Database initialization

Notice that upon broker initialization, this calls PGMQ.initialize which tries very hard to create the pgmq schema for you.

If you also want to pre-create the database itself, with some given user, you can try something like this:

import Shelly qualified as SH

createDBIfNotExists :: Text -> Text -> IO ()
createDBIfNotExists connStr dbName = do
  -- For the \gexec trick, see:
  -- https://stackoverflow.com/questions/18389124/simulate-create-database-if-not-exists-for-postgresql
  (_res, _ec) <- SH.shelly $ SH.silently $ SH.escaping False $ do
    let sql = "\"SELECT 'CREATE DATABASE " <> dbName <> "' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '" <> dbName <> "')\\gexec\""
    result <- SH.run "echo" [sql, "|", "psql", "-d", "\"" <> connStr <> "\""]
    (result,) <$> SH.lastExitCode
    
  return ()