/
EventStorePersistentSubscription.php
117 lines (102 loc) · 3.41 KB
/
EventStorePersistentSubscription.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
/**
* This file is part of prooph/event-store.
* (c) 2014-2020 Alexander Miertsch <kontakt@codeliner.ws>
* (c) 2015-2020 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Prooph\EventStore\Async;
use Amp\Promise;
use Prooph\EventStore\EventId;
use Prooph\EventStore\Internal\ResolvedEvent;
use Prooph\EventStore\PersistentSubscriptionNakEventAction;
interface EventStorePersistentSubscription
{
public const DEFAULT_BUFFER_SIZE = 10;
/**
* @internal
*
* @return Promise<self>
*/
public function start(): Promise;
/**
* Acknowledge that a message have completed processing (this will tell the server it has been processed)
* Note: There is no need to ack a message if you have Auto Ack enabled
*
* @param ResolvedEvent $event
*
* @return void
*/
public function acknowledge(ResolvedEvent $event): void;
/**
* Acknowledge that a message have completed processing (this will tell the server it has been processed)
* Note: There is no need to ack a message if you have Auto Ack enabled
*
* @param ResolvedEvent[] $events
*
* @return void
*/
public function acknowledgeMultiple(array $events): void;
/**
* Acknowledge that a message have completed processing (this will tell the server it has been processed)
* Note: There is no need to ack a message if you have Auto Ack enabled
*
* @param EventId $eventId
*
* @return void
*/
public function acknowledgeEventId(EventId $eventId): void;
/**
* Acknowledge that a message have completed processing (this will tell the server it has been processed)
* Note: There is no need to ack a message if you have Auto Ack enabled
*
* @param EventId[] $eventIds
*
* @return void
*/
public function acknowledgeMultipleEventIds(array $eventIds): void;
/**
* Mark a message failed processing. The server will be take action based upon the action paramter
*/
public function fail(
ResolvedEvent $event,
PersistentSubscriptionNakEventAction $action,
string $reason
): void;
/**
* Mark n messages that have failed processing. The server will take action based upon the action parameter
*
* @param ResolvedEvent[] $events
* @param PersistentSubscriptionNakEventAction $action
* @param string $reason
*/
public function failMultiple(
array $events,
PersistentSubscriptionNakEventAction $action,
string $reason
): void;
/**
* Mark a message failed processing. The server will be take action based upon the action paramter
*/
public function failEventId(
EventId $eventId,
PersistentSubscriptionNakEventAction $action,
string $reason
): void;
/**
* Mark n messages that have failed processing. The server will take action based upon the action parameter
*
* @param EventId[] $eventIds
* @param PersistentSubscriptionNakEventAction $action
* @param string $reason
*/
public function failMultipleEventIds(
array $eventIds,
PersistentSubscriptionNakEventAction $action,
string $reason
): void;
public function stop(?int $timeout = null): Promise;
}