-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathQueueInterface.php
More file actions
46 lines (37 loc) · 1.18 KB
/
QueueInterface.php
File metadata and controls
46 lines (37 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
namespace Yiisoft\Queue;
use InvalidArgumentException;
use Yiisoft\Queue\Adapter\AdapterInterface;
use Yiisoft\Queue\Message\MessageInterface;
use Yiisoft\Queue\Middleware\Push\MiddlewarePushInterface;
interface QueueInterface
{
/**
* Pushes a message into the queue.
*
* @param array|callable|MiddlewarePushInterface|string ...$middlewareDefinitions
* @return MessageInterface
*/
public function push(MessageInterface $message, MiddlewarePushInterface|callable|array|string ...$middlewareDefinitions): MessageInterface;
/**
* Execute all existing jobs and exit
*
* @return int Number of messages processed.
*/
public function run(int $max = 0): int;
/**
* Listen to the queue and execute jobs as they come
*/
public function listen(): void;
/**
* @param int|string $id A message id
*
* @throws InvalidArgumentException when there is no such id in the adapter
*
* @return JobStatus
*/
public function status(string|int $id): JobStatus;
public function withAdapter(AdapterInterface $adapter): static;
public function getChannel(): string;
}