Thin elixir client for the pgmq postgres extension.
For instructions on installing the pgmq extension, or getting a docker image with the extension installed, check the official pgmq repo.
The package can be installed by adding pgmq
to your list of dependencies in
mix.exs
:
def deps do
[
{:pgmq, "~> 0.1.0"}
]
end
If needed, you can create a migration to create the extension in your database:
defmodule MyApp.Repo.Migrations.CreatePgmqExtension do
use Ecto.Migration
def change do
execute("CREATE EXTENSION pgmq CASCADE")
end
end
And to create queues:
defmodule MyApp.Repo.Migrations.CreateSomeQueues do
use Ecto.Migration
def up do
Pgmq.create_queue(repo(), "queue_a")
Pgmq.create_queue(repo(), "queue_b")
Pgmq.create_queue(repo(), "queue_c")
end
def down do
Pgmq.drop_queue(repo(), "queue_a")
Pgmq.drop_queue(repo(), "queue_b")
Pgmq.drop_queue(repo(), "queue_c")
end
end
Check our documentation in Hexdocs.
The OffBroadwayPgmq package provides a configurable Broadway adapter that manages reading, acking and archiving failing messages.
This package (and pgmq) are both pre-1.0 and might have breaking changes.