-
Notifications
You must be signed in to change notification settings - Fork 4
/
example-failure-transports.php
47 lines (44 loc) · 1.79 KB
/
example-failure-transports.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
<?php
declare(strict_types=1);
use Netglue\PsrContainer\Messenger\Container\TransportFactory;
/**
* Symfony 6 allows specifying different failure transports on a per transport basis
*
* If a global default failure transport is defined, this transport will be used when something specific
* has not been defined.
*/
return [
'symfony' => [
'messenger' => [
'failure_transport' => 'my_default_failure_transport',
'transports' => [
// 2 arbitrary transports for specific message types:
'events_transport' => [
'dsn' => 'in-memory:///',
// Failed 'events' will be dispatched to the default failure transport `my_default_failure_transport`
],
'commands_transport' => [
'dsn' => 'in-memory:///',
'failure_transport' => 'command_failures',
// Failed 'commands' will be dispatched to the `command_failures` transport
],
// 2 different failure transports
'my_default_failure_transport' => [
'dsn' => 'in-memory:///',
],
'command_failures' => [
'dsn' => 'in-memory:///',
],
],
],
],
'dependencies' => [
'factories' => [
// All transports need to be listed in dependencies:
'events_transport' => [TransportFactory::class, 'events_transport'],
'commands_transport' => [TransportFactory::class, 'commands_transport'],
'my_default_failure_transport' => [TransportFactory::class, 'my_default_failure_transport'],
'command_failures' => [TransportFactory::class, 'command_failures'],
],
],
];