Skip to main content

delete_queue_message

SQL 0.1.1 · Source cbff27b8a34e1384384018680e46c20d5c610cc9.

Signature​

postgremq.delete_queue_message(p_queue_name character varying, p_message_id bigint)
RETURNS void

The signature, defaults, and result above were extracted from the installed PostgreSQL catalog.

Discard one delivery​

Deletes the delivery row for one queue/message in any status, including in-flight or completed. Other queues, payload, and any separate DLQ entry remain. Removing an unsettled grouped row emits a queue wake-up and may permit its successor.

Transactions and errors​

Destructive and transactional; deleted work is gone on commit regardless of whether a worker already began effects. Missing row is a no-op. Locks can wait until conflicting transactions finish. Payload collection happens later.

All calls require the applicable caller privileges. See SQL errors for driver failures and uncertain outcomes.

Example​

Run in psql with ON_ERROR_STOP and fresh reference-* names. ROLLBACK removes the fixtures.

BEGIN;
SELECT postgremq.create_topic('reference-events');
SELECT postgremq.create_queue('reference-jobs', 'reference-events', 2, false);
SELECT postgremq.publish_message('reference-events', '{"number":1}'::jsonb) AS id \gset ref_
SELECT postgremq.delete_queue_message('reference-jobs', :ref_id);
ROLLBACK;

Only the fixture delivery is removed; its payload remains until unreferenced collection.

Related: Topology, SQL conventions.