Generic interfaces package
- 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
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;
}