Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 966 Bytes

queue.md

File metadata and controls

34 lines (25 loc) · 966 Bytes

Queue

Introduction

queue()->count();
queue()->push((new JobAwesome($yourData))->attempts(3)->delay(60)->queue('high'));
queue()->name('priority')->pop(); // return null or and a JobInterface

Queue Worker

Ask every queue for a job, if one of these response a job. Work on it and start again from the first queue.

php console tinyframework:queue:worker --queue high --queue medium --queue low -vvv

You can test it with:

php console tinyframework:shell
container('queue')->push((new TinyFramework\Queue\TestJob())->queue('low'));
container('queue')->push((new TinyFramework\Queue\TestJob())->queue('low'));
container('queue')->push((new TinyFramework\Queue\TestJob())->queue('medium'));
container('queue')->push((new TinyFramework\Queue\TestJob())->queue('high'));
container('queue')->push((new TinyFramework\Queue\TestJob())->queue('low'));