StudioBonito\SilverStripe\Queue\Worker
Synopsis
class Worker
{
- // members
- protected QueueManager $manager;
- protected FailedJobProviderInterface $failer;
- protected bool $stop = false;
- // methods
- public void __construct()
- public array daemon()
- protected void runNextJobForDaemon()
- public void pop()
- protected JobInterface|null getNextJob()
- public void process()
- protected void logFailedJob()
- public bool memoryExceeded()
- public void stop()
- public void sleep()
Members
protected
- $failer
—
\StudioBonito\SilverStripe\Queue\Failed\FailedJobProviderInterface
The failed job provider implementation. - $manager
—
\StudioBonito\SilverStripe\Queue\QueueManager
THe queue manager instance. - $stop
—
StudioBonito\SilverStripe\Queue\bool
Flag used when running as a daemon.
Methods
protected
- getNextJob() — Get the next job from the queue connection.
- logFailedJob() — Log a failed job into storage.
- runNextJobForDaemon() — Run the next job for the daemon worker.
public
- __construct() — Create a new queue worker.
- daemon() — Listen to the given queue in a loop.
- memoryExceeded() — Determine if the memory limit has been exceeded.
- pop() — Listen to the given queue.
- process() — Process a given job from the queue.
- sleep() — Sleep the script for a given number of seconds.
- stop() — Stop listening and bail out of the script.