Skip to content

Latest commit

 

History

History
56 lines (47 loc) · 1.38 KB

README.md

File metadata and controls

56 lines (47 loc) · 1.38 KB

Pgmq

Thin elixir client for the pgmq postgres extension.

Installation

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

Documentation

Check our documentation in Hexdocs.

Usage with Broadway

The OffBroadwayPgmq package provides a configurable Broadway adapter that manages reading, acking and archiving failing messages.

Stability warning

This package (and pgmq) are both pre-1.0 and might have breaking changes.