1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace TMV\Messenger; |
6
|
|
|
|
7
|
|
|
use Symfony\Component\Messenger as SFMessenger; |
8
|
|
|
use Zend\ServiceManager\Factory\InvokableFactory; |
9
|
|
|
|
10
|
|
|
class ConfigProvider |
11
|
|
|
{ |
12
|
3 |
|
public function getDependencies(): array |
13
|
|
|
{ |
14
|
|
|
return [ |
15
|
|
|
'aliases' => [ |
16
|
3 |
|
SFMessenger\Transport\Sender\SendersLocatorInterface::class => SFMessenger\Transport\Sender\SendersLocator::class, |
17
|
|
|
SFMessenger\Transport\TransportFactoryInterface::class => SFMessenger\Transport\TransportFactory::class, |
18
|
|
|
], |
19
|
|
|
'factories' => [ |
20
|
|
|
Transport\Doctrine\DoctrineDBALTransportFactory::class => Factory\Transport\Doctrine\DoctrineDBALTransportFactoryFactory::class, |
21
|
|
|
SFMessenger\Transport\InMemoryTransportFactory::class => InvokableFactory::class, |
22
|
|
|
SFMessenger\Transport\AmqpExt\AmqpTransportFactory::class => InvokableFactory::class, |
23
|
|
|
SFMessenger\Transport\Doctrine\DoctrineTransportFactory::class => InvokableFactory::class, |
24
|
|
|
SFMessenger\Transport\RedisExt\RedisTransportFactory::class => InvokableFactory::class, |
25
|
|
|
SFMessenger\Transport\Sync\SyncTransportFactory::class => Factory\Transport\Sync\SyncTransportFactoryFactory::class, |
26
|
|
|
SFMessenger\Transport\TransportFactory::class => Factory\Transport\TransportFactoryFactory::class, |
27
|
|
|
SFMessenger\Transport\Sender\SendersLocator::class => Factory\Transport\Sender\SendersLocatorFactory::class, |
28
|
|
|
SFMessenger\Transport\Serialization\PhpSerializer::class => InvokableFactory::class, |
29
|
|
|
SFMessenger\Transport\Serialization\Serializer::class => InvokableFactory::class, |
30
|
|
|
SFMessenger\EventListener\SendFailedMessageForRetryListener::class => Factory\Listener\SendFailedMessageForRetryListenerFactory::class, |
31
|
|
|
SFMessenger\EventListener\SendFailedMessageToFailureTransportListener::class => Factory\Listener\SendFailedMessageToFailureTransportListenerFactory::class, |
32
|
|
|
SFMessenger\EventListener\StopWorkerOnRestartSignalListener::class => Factory\Listener\StopWorkerOnRestartSignalListenerFactory::class, |
33
|
|
|
SFMessenger\Command\ConsumeMessagesCommand::class => Factory\Command\ConsumeMessagesCommandFactory::class, |
34
|
|
|
SFMessenger\Command\StopWorkersCommand::class => Factory\Command\StopWorkersCommandFactory::class, |
35
|
|
|
SFMessenger\Command\SetupTransportsCommand::class => Factory\Command\SetupTransportsCommandFactory::class, |
36
|
|
|
SFMessenger\Command\FailedMessagesRemoveCommand::class => Factory\Command\FailedMessagesRemoveCommandFactory::class, |
37
|
|
|
SFMessenger\Command\FailedMessagesRetryCommand::class => Factory\Command\FailedMessagesRetryCommandFactory::class, |
38
|
|
|
SFMessenger\Command\FailedMessagesShowCommand::class => Factory\Command\FailedMessagesShowCommandFactory::class, |
39
|
|
|
'messenger.bus.default' => [Factory\MessageBusFactory::class, 'messenger.bus.default'], |
40
|
|
|
'messenger.event_dispatcher' => Factory\EventDispatcherFactory::class, |
41
|
|
|
'messenger.routable_message_bus' => [Factory\RoutableMessageBusFactory::class, 'messenger.bus.default'], |
42
|
|
|
'messenger.retry_strategy_locator' => Factory\Retry\RetryStrategyLocatorFactory::class, |
43
|
|
|
'messenger.receivers_locator' => Factory\Transport\Receiver\ReceiversLocatorFactory::class, |
44
|
|
|
], |
45
|
|
|
]; |
46
|
|
|
} |
47
|
|
|
|
48
|
2 |
|
public function __invoke(): array |
49
|
|
|
{ |
50
|
|
|
return [ |
51
|
2 |
|
'dependencies' => $this->getDependencies(), |
52
|
|
|
'messenger' => [ |
53
|
|
|
'failure_transport' => null, |
54
|
|
|
'event_dispatcher' => 'messenger.event_dispatcher', |
55
|
|
|
'logger' => null, |
56
|
|
|
'default_serializer' => SFMessenger\Transport\Serialization\PhpSerializer::class, |
57
|
|
|
'cache_pool_for_restart_signal' => null, |
58
|
|
|
'transport_factories' => [ |
59
|
|
|
SFMessenger\Transport\Sync\SyncTransportFactory::class, |
60
|
|
|
SFMessenger\Transport\InMemoryTransportFactory::class, |
61
|
|
|
SFMessenger\Transport\AmqpExt\AmqpTransportFactory::class, |
62
|
|
|
SFMessenger\Transport\RedisExt\RedisTransportFactory::class, |
63
|
|
|
Transport\Doctrine\DoctrineDBALTransportFactory::class, |
64
|
|
|
], |
65
|
|
|
'buses' => [ |
66
|
|
|
'messenger.bus.default' => [ |
67
|
|
|
'middleware' => [], |
68
|
|
|
'default_middleware' => true, |
69
|
|
|
'allow_no_handler' => false, |
70
|
|
|
'handlers' => [], |
71
|
|
|
'routes' => [], |
72
|
|
|
], |
73
|
|
|
], |
74
|
|
|
'transports' => [], |
75
|
|
|
], |
76
|
|
|
]; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|