amtgard / amtgard-interfaces
Generic interfaces for use by Amtgard dependencies
v1.0.2
2025-08-01 18:39 UTC
Requires
- php: >=8.1
This package is auto-updated.
Last update: 2026-03-05 17:05:25 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()eddequeue()ed entries. Alldequeue()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; }