1
|
|
|
<?php |
2
|
|
|
namespace PSB\Core\Pipeline; |
3
|
|
|
|
4
|
|
|
|
5
|
|
|
use PSB\Core\DateTimeConverter; |
6
|
|
|
use PSB\Core\Feature\Feature; |
7
|
|
|
use PSB\Core\ObjectBuilder\BuilderInterface; |
8
|
|
|
use PSB\Core\Pipeline\Outgoing\ImmediateDispatchTerminator; |
9
|
|
|
use PSB\Core\Pipeline\Outgoing\OutgoingContextFactory; |
10
|
|
|
use PSB\Core\Pipeline\Outgoing\OutgoingPhysicalToDispatchConnector; |
11
|
|
|
use PSB\Core\Transport\MessageDispatcherInterface; |
12
|
|
|
use PSB\Core\Transport\SendingFeature; |
13
|
|
|
use PSB\Core\Util\Clock\ClockInterface; |
14
|
|
|
use PSB\Core\Util\Settings; |
15
|
|
|
|
16
|
|
|
class OutgoingPipelineFeature extends Feature |
17
|
|
|
{ |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Method will always be executed and should be used to determine whether to enable or disable the feature, |
21
|
|
|
* configure default settings, configure dependencies, configure prerequisites and register startup tasks. |
22
|
|
|
*/ |
23
|
1 |
|
public function describe() |
24
|
|
|
{ |
25
|
1 |
|
$this->enableByDefault(); |
26
|
1 |
|
$this->dependsOn(SendingFeature::class); |
27
|
1 |
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Method is called if all defined conditions are met and the feature is marked as enabled. |
31
|
|
|
* Use this method to configure and initialize all required components for the feature like |
32
|
|
|
* the steps in the pipeline or the instances/factories in the container. |
33
|
|
|
* |
34
|
|
|
* @param Settings $settings |
35
|
|
|
* @param BuilderInterface $builder |
36
|
|
|
* @param PipelineModifications $pipelineModifications |
37
|
|
|
*/ |
38
|
1 |
|
public function setup( |
39
|
|
|
Settings $settings, |
40
|
|
|
BuilderInterface $builder, |
41
|
|
|
PipelineModifications $pipelineModifications |
42
|
|
|
) { |
43
|
1 |
|
$pipelineModifications->registerStep( |
44
|
1 |
|
'OutgoingPhysicalToDispatchConnector', |
45
|
1 |
|
OutgoingPhysicalToDispatchConnector::class, |
46
|
|
|
function () use ($builder) { |
47
|
|
|
return new OutgoingPhysicalToDispatchConnector( |
48
|
|
|
$builder->build(OutgoingContextFactory::class), |
49
|
|
|
$builder->build(DateTimeConverter::class), |
50
|
|
|
$builder->build(ClockInterface::class) |
51
|
|
|
); |
52
|
1 |
|
} |
53
|
|
|
); |
54
|
1 |
|
$pipelineModifications->registerStep( |
55
|
1 |
|
'ImmediateDispatchTerminator', |
56
|
1 |
|
ImmediateDispatchTerminator::class, |
57
|
|
|
function () use ($builder) { |
58
|
|
|
return new ImmediateDispatchTerminator($builder->build(MessageDispatcherInterface::class)); |
59
|
1 |
|
} |
60
|
|
|
); |
61
|
1 |
|
} |
62
|
|
|
} |
63
|
|
|
|