| 1 | <?php |
||
| 9 | abstract class DispatchingRule |
||
| 10 | { |
||
| 11 | const PRIORITY_VERY_LOW = -10; |
||
| 12 | const PRIORITY_LOW = -5; |
||
| 13 | const PRIORITY_NORMAL = 0; |
||
| 14 | const PRIORITY_MEDIUM = 5; |
||
| 15 | const PRIORITY_HIGH = 10; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var int |
||
| 19 | */ |
||
| 20 | protected $priority = self::PRIORITY_NORMAL; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Decides in what queue a job should be dispatched |
||
| 24 | * |
||
| 25 | * @param Job $job |
||
| 26 | * |
||
| 27 | * @return string Queue name, or null if It doesn't decide |
||
| 28 | */ |
||
| 29 | public abstract function __invoke(Job $job); |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return int |
||
| 33 | */ |
||
| 34 | public function getPriority() |
||
| 38 | } |