-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOutboxReaderInterface.php
46 lines (38 loc) · 1.1 KB
/
OutboxReaderInterface.php
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);
/*
* This file is part of rekalogika/domain-event-src package.
*
* (c) Priyadi Iman Nurcahyo <https://rekalogika.dev>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/
namespace Rekalogika\DomainEvent\Outbox;
use Symfony\Component\Messenger\Envelope;
/**
* Manages the messages in the outbox queue.
*/
interface OutboxReaderInterface
{
/**
* Gets messages from the outbox queue. Starting from the earlier first.
* Should implicitly start a transaction, that will be committed using
* `flush()`.
*
* @return iterable<int|string,Envelope>
*/
public function getOutboxMessages(int $limit): iterable;
/**
* Removes a message from the outbox queue by its id.
*/
public function removeOutboxMessageById(int|string $id): void;
/**
* Flags a message as errored.
*/
public function flagError(int|string $id): void;
/**
* Commits the transaction started by getOutboxMessages.
*/
public function flush(): void;
}