-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathQueueInterface.php
More file actions
43 lines (35 loc) · 975 Bytes
/
QueueInterface.php
File metadata and controls
43 lines (35 loc) · 975 Bytes
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
<?php
declare(strict_types=1);
namespace Yiisoft\Queue;
use Yiisoft\Queue\Message\MessageInterface;
interface QueueInterface
{
/**
* Pushes a message into the queue.
*
* @param MessageInterface $message The message to push.
*
* @return MessageInterface The pushed message, possibly enriched with metadata such as an assigned ID.
*/
public function push(MessageInterface $message): MessageInterface;
/**
* Handle all existing messages and exit
*
* @return int Number of messages processed.
*/
public function run(int $max = 0): int;
/**
* Listen to the queue and handle messages as they come
*/
public function listen(): void;
/**
* @param int|string $id A message ID.
*
* @return MessageStatus
*/
public function status(string|int $id): MessageStatus;
/**
* Returns the logical name of the queue.
*/
public function getName(): string;
}