-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmessenger.php
More file actions
63 lines (58 loc) · 2.21 KB
/
messenger.php
File metadata and controls
63 lines (58 loc) · 2.21 KB
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
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use App\Domain\User\Event\UserCreatedEvent;
return static function (ContainerConfigurator $container) {
$container->extension('framework', [
'messenger' => [
'buses' => [
'useCase.bus' => [
'middleware' => [
'dispatch_after_current_bus',
//'doctrine_transaction'
],
'default_middleware' => [
'enabled' => true
]
],
'domain.event.bus' => [
'middleware' => [
'dispatch_after_current_bus',
//'doctrine_transaction'
],
'default_middleware' => [
'enabled' => true,
'allow_no_handlers' => true
]
],
'integration.event.bus' => [
'middleware' => [
'dispatch_after_current_bus'
],
'default_middleware' => [
'enabled' => true,
'allow_no_handlers' => true
]
]
],
'default_bus' => 'useCase.bus',
'transports' => [
'sync' => 'sync://',
'async' => [
'dsn' => $_ENV['MESSENGER_TRANSPORT_DSN'],
'retry_strategy' => [
'max_retries' => 2,
'delay' => 3000,
'multiplier' => 2,
]
]
],
'routing' => [
# all messages by default use sync transport
\Symfony\Component\Mailer\Messenger\SendEmailMessage::class => ['async'],
\Symfony\Component\Notifier\Message\MessageInterface::class => ['async'],
\App\Application\Common\IntegrationEvent\IntegrationEventInterface::class => ['async'],
\App\Domain\User\Event\UserCreatedEvent::class => ['async'],
],
],
]);
};