amtgard/amtgard-interfaces

Generic interfaces for use by Amtgard dependencies

v1.0.2 2025-08-01 18:39 UTC

This package is auto-updated.

Last update: 2025-08-05 15:31:48 UTC


README

Generic interfaces package

Interfaces Defined

  • EntryInterface - a key value pair
  • HashSetInterface - a set interface using EntryInterface elements
  • QueueInterface - a queue interface using EntryInterface elements
  • RedrivableQueueInterface - a redrivable queue interface (see below)
  • SetQueue - a Queue that dedupes entries based on a Set
  • PubSubQueueInterface - a pub/sub topic provider based on a redrivable SetQueue

Definitions

RedrivableQueueInterface

A redrivable queue operates just like a normal queue (enqueue(), dequeue()) but adds two new interface methods:

  • redrive() - replays all un-commit()ed dequeue()ed entries. All dequeue()ed entries are automatically appended to the redrive queue.
  • commit() - marks an entry as non-redrivable (removes from the redrive queue)

So in operation, your workflow would be something like this:

$entry = $redrivableQ->dequeue();
$requiresRedrive = false;
try {
  $processStatus = processEntry($entry);
  if (SUCCESS == $processStatus) {
    $redrivableQ->commit($entry);
  }
} catch (\ProcessingException $e) {
    $requiresRedrive = true;
}