ack_message
SQL 0.1.1 · Source cbff27b8a34e1384384018680e46c20d5c610cc9.
Signature
postgremq.ack_message(p_queue_name character varying, p_message_id bigint, p_consumer_token character varying)
RETURNS void
The signature, defaults, and result above were extracted from the installed PostgreSQL catalog.
Complete one queue delivery
Marks the matching processing delivery completed, clears its token, and records completion time. Other queues are unaffected. For grouped work it emits a queue wake-up on commit so a successor can proceed. Completed history remains until retention.
Transactions and errors
PMQ01: no matching processing state/token, including missing or already settled deliveries. Elapsed VT alone is not rejected if the token remains current. The row update can wait for locks and commits with the caller transaction; combine application writes here for atomic effects.
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 * FROM postgremq.consume_message('reference-jobs', 30, 1) \gset claim_
SELECT postgremq.ack_message('reference-jobs', :claim_message_id, :'claim_consumer_token');
ROLLBACK;
The delivery is completed within the transaction. Rollback in this example undoes completion and all fixture writes.
Related: Acknowledgements, SQL conventions.