extend_queue_keep_alive_multi
SQL 0.1.1 · Source cbff27b8a34e1384384018680e46c20d5c610cc9.
Signature
postgremq.extend_queue_keep_alive_multi(p_queue_names character varying[], p_intervals_ms bigint[], p_generations uuid[] DEFAULT NULL::uuid[])
RETURNS TABLE(queue_name character varying, keep_alive_until timestamp with time zone, outcome text)
The signature, defaults, and result above were extracted from the installed PostgreSQL catalog.
Renew Exclusive subscription lifetimes
Parallel arrays identify queue names, positive lifetime milliseconds, and optional expected generations. A NULL generations array or element accepts whichever incarnation exists. Live matching Exclusive queues return extended with a new expiry. Expired, missing, Durable, or generation-mismatched queues are omitted.
Transactions and errors
PMQ03: mismatched lengths or NULL/nonpositive milliseconds. Passing NULL for both required arrays with the default NULL generations argument raises PostgreSQL 22004 (null array dimension), rather than PMQ03. Supply non-null arrays; empty arrays represent an empty batch. NOWAIT conflict returns busy with no deadline and no confirmation of continued ownership. The function cannot revive expiry. Entry locks last until transaction end; long transactions publishing or changing those queues can contend.
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-session', 'reference-events', 5, true, interval '1 minute') AS generation \gset ref_
SELECT * FROM postgremq.extend_queue_keep_alive_multi(
ARRAY['reference-session']::varchar[], ARRAY[60000]::bigint[],
ARRAY[:'ref_generation'::uuid]);
ROLLBACK;
The result is extended for the declared generation. Consumption and publication do not perform this renewal.
Related: Exclusive queues, SQL conventions.