BroadwayPgQue.Acknowledger (broadway_pgque v0.1.1)

Copy Markdown View Source

Broadway acknowledger that completes PgQue batches and routes retries/DLQ events.

Acknowledgement Semantics

  • Success: When messages are processed successfully, the entire batch is closed via pgque.ack(batch_id).
  • Failure Options:
    • {:snooze, seconds} or {:retry, seconds} - event is scheduled for retry via pgque.event_retry/4.
    • {:dead, reason} or {:cancel, reason} - event is immediately moved to DLQ via pgque.event_dead/4.
    • Other failure reason - routes according to :on_failure configuration (:dead or :retry), using :default_retry_delay if retrying.

Summary

Functions

Decrements the batch's atomic in-flight message counter and returns true when all messages from the PgQue batch have finished processing.

Notifies the originating producer process that the active batch has been acknowledged.

Functions

finish_batch?(ack_data, processed_count)

@spec finish_batch?(map(), pos_integer()) :: boolean()

Decrements the batch's atomic in-flight message counter and returns true when all messages from the PgQue batch have finished processing.

notify_producer_batch_acked(ack_data, batch_id)

@spec notify_producer_batch_acked(map(), integer()) :: :ok

Notifies the originating producer process that the active batch has been acknowledged.