|
113 | 113 | use Patchlevel\EventSourcingBundle\EventBus\SymfonyEventBus; |
114 | 114 | use Patchlevel\EventSourcingBundle\RequestListener\AutoSetupListener; |
115 | 115 | use Patchlevel\EventSourcingBundle\RequestListener\SubscriptionRebuildAfterFileChangeListener; |
| 116 | +use Patchlevel\EventSourcingBundle\Subscription\ResetServicesListener; |
116 | 117 | use Patchlevel\EventSourcingBundle\Subscription\StaticInMemorySubscriptionStoreFactory; |
117 | 118 | use Patchlevel\EventSourcingBundle\ValueResolver\AggregateRootIdValueResolver; |
118 | 119 | use Patchlevel\Hydrator\Cryptography\Cipher\Cipher; |
|
126 | 127 | use Patchlevel\Hydrator\Metadata\AttributeMetadataFactory; |
127 | 128 | use Patchlevel\Hydrator\Metadata\MetadataFactory; |
128 | 129 | use Patchlevel\Hydrator\MetadataHydrator; |
| 130 | +use Patchlevel\Worker\Event\WorkerRunningEvent; |
129 | 131 | use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; |
130 | 132 | use Symfony\Component\DependencyInjection\ChildDefinition; |
131 | 133 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
@@ -375,6 +377,15 @@ static function (ChildDefinition $definition): void { |
375 | 377 |
|
376 | 378 | $container->setAlias(SubscriptionEngine::class, DefaultSubscriptionEngine::class); |
377 | 379 |
|
| 380 | + $container->register(ResetServicesListener::class) |
| 381 | + ->setArguments([ |
| 382 | + new Reference('services_resetter'), |
| 383 | + ]) |
| 384 | + ->addTag('kernel.event_listener', [ |
| 385 | + 'event' => WorkerRunningEvent::class, |
| 386 | + 'method' => 'onWorkerRunningEvent', |
| 387 | + ]); |
| 388 | + |
378 | 389 | if ($config['subscription']['throw_on_error']['enabled']) { |
379 | 390 | $container->register(ThrowOnErrorSubscriptionEngine::class) |
380 | 391 | ->setDecoratedService(SubscriptionEngine::class) |
@@ -773,13 +784,15 @@ private function configureCommands(ContainerBuilder $container): void |
773 | 784 | $container->register(SubscriptionBootCommand::class) |
774 | 785 | ->setArguments([ |
775 | 786 | new Reference(SubscriptionEngine::class), |
| 787 | + new Reference('event_dispatcher', ContainerInterface::NULL_ON_INVALID_REFERENCE), |
776 | 788 | ]) |
777 | 789 | ->addTag('console.command'); |
778 | 790 |
|
779 | 791 | $container->register(SubscriptionRunCommand::class) |
780 | 792 | ->setArguments([ |
781 | 793 | new Reference(SubscriptionEngine::class), |
782 | 794 | new Reference(Store::class), |
| 795 | + new Reference('event_dispatcher', ContainerInterface::NULL_ON_INVALID_REFERENCE), |
783 | 796 | ]) |
784 | 797 | ->addTag('console.command'); |
785 | 798 |
|
|
0 commit comments