-
Notifications
You must be signed in to change notification settings - Fork 3
/
SagaHeader.php
74 lines (66 loc) · 1.6 KB
/
SagaHeader.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
<?php
/**
* Saga pattern implementation.
*
* @author Maksim Masiukevich <contacts@desperado.dev>
* @license MIT
* @license https://opensource.org/licenses/MIT
*/
declare(strict_types = 0);
namespace ServiceBus\Sagas\Configuration\Attributes;
/**
* @psalm-immutable
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
final class SagaHeader
{
/**
* Saga identifier class.
*
* @psalm-readonly
* @psalm-var class-string<\ServiceBus\Sagas\SagaId>
*
* @var string
*/
public $idClass;
/**
* Place to look for a correlation identifier (event property: event; header key: headers).
*
* @psalm-readonly
*
* @var string
*/
public $containingIdSource;
/**
* The event property (or header key) that contains the saga ID.
*
* @psalm-readonly
*
* @var string
*/
public $containingIdProperty;
/**
* Saga expire date modifier.
*
* @psalm-readonly
*
* @see http://php.net/manual/ru/datetime.formats.relative.php
*
* @var string|null
*/
public $expireDateModifier;
/**
* @psalm-param class-string<\ServiceBus\Sagas\SagaId> $idClass
*/
public function __construct(
string $idClass,
string $containingIdProperty,
string $containingIdSource = 'event',
?string $expireDateModifier = null
) {
$this->idClass = $idClass;
$this->containingIdProperty = $containingIdProperty;
$this->containingIdSource = $containingIdSource;
$this->expireDateModifier = $expireDateModifier;
}
}