|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of forecast.it.fill project. |
|
7
|
|
|
* (c) Patrick Jaja <[email protected]> |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace ForecastAutomation\QueueClient\Shared\Dto; |
|
13
|
|
|
|
|
14
|
|
|
use ForecastAutomation\Kernel\Shared\Dto\AbstractDto; |
|
15
|
|
|
|
|
16
|
|
|
// https://github.com/cloudevents/spec/blob/v1.0.1/json-format.md#32-examples |
|
17
|
|
|
// https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-overview/ |
|
18
|
|
|
class MessageDto extends AbstractDto |
|
19
|
|
|
{ |
|
20
|
|
|
public function __construct( |
|
21
|
|
|
public array $data = [], |
|
22
|
|
|
public string $queueName = 'queueName', |
|
23
|
|
|
public string $type = 'eventName', |
|
24
|
|
|
public string $specversion = '1.0', |
|
25
|
|
|
public string $datacontenttype = 'application/json', |
|
26
|
|
|
public string $id = '', |
|
27
|
|
|
public int $time = 0, |
|
28
|
|
|
public array $adapterMetaResponse = [], |
|
29
|
|
|
) { |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function setData(array $data): self |
|
33
|
|
|
{ |
|
34
|
|
|
$this->data = $data; |
|
35
|
|
|
|
|
36
|
|
|
return $this; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function setQueueName(string $queueName): self |
|
40
|
|
|
{ |
|
41
|
|
|
$this->queueName = $queueName; |
|
42
|
|
|
|
|
43
|
|
|
return $this; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function setType(string $type): self |
|
47
|
|
|
{ |
|
48
|
|
|
$this->type = $type; |
|
49
|
|
|
|
|
50
|
|
|
return $this; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function setSpecversion(string $specversion): self |
|
54
|
|
|
{ |
|
55
|
|
|
$this->specversion = $specversion; |
|
56
|
|
|
|
|
57
|
|
|
return $this; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function setDatacontenttype(string $datacontenttype): self |
|
61
|
|
|
{ |
|
62
|
|
|
$this->datacontenttype = $datacontenttype; |
|
63
|
|
|
|
|
64
|
|
|
return $this; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function setId(string $id): self |
|
68
|
|
|
{ |
|
69
|
|
|
$this->id = $id; |
|
70
|
|
|
|
|
71
|
|
|
return $this; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function setTime(int $time): self |
|
75
|
|
|
{ |
|
76
|
|
|
$this->time = $time; |
|
77
|
|
|
|
|
78
|
|
|
return $this; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function setAdapterMetaResponse(array $adapterMetaResponse): self |
|
82
|
|
|
{ |
|
83
|
|
|
$this->adapterMetaResponse = $adapterMetaResponse; |
|
84
|
|
|
|
|
85
|
|
|
return $this; |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|