Queues
Tested with: Databasezy API v1 · PostgreSQL 17 · pgmq 1.13
Queues are durable message queues stored in your Postgres instance with pgmq. Messages are read with a visibility timeout, so a worker that crashes does not lose them, and processed messages can be archived for later inspection. Open the instance in the portal and choose Queues.
From SQL
Section titled “From SQL”select pgmq.create('emails');
-- Read up to 10 messages and hide them from other readers for 30 secondsselect * from pgmq.read('emails', 30, 10);
-- Done with message 1: archive it (or pgmq.delete to drop it)select pgmq.archive('emails', 1);From the API
Section titled “From the API”zb api POST /v1/orgs/{org}/instances/inst_01jb.../queues -d '{"name": "emails"}'zb api POST /v1/orgs/{org}/instances/inst_01jb.../queues/emails/messages -d '{ "messages": [{"to": "[email protected]"}], "delay_seconds": 0}'zb api GET /v1/orgs/{org}/instances/inst_01jb.../queues # depth, total messages, age of the oldestunlogged: true creates a faster queue that does not survive a crash.
From the Data API
Section titled “From the Data API”Roles listed in a queue’s data_api_roles (default service_role) can use it through the
Data API with the pgmq_public functions send, send_batch, read, pop, archive and
delete. Change the roles with PUT .../queues/<name>/permissions.