vendor/enqueue/async-event-dispatcher/DependencyInjection/AsyncEventDispatcherExtension.php line 16

Open in your IDE?
  1. <?php
  2. namespace Enqueue\AsyncEventDispatcher\DependencyInjection;
  3. use Enqueue\AsyncEventDispatcher\AsyncProcessor;
  4. use Enqueue\AsyncEventDispatcher\Commands;
  5. use Symfony\Component\Config\FileLocator;
  6. use Symfony\Component\DependencyInjection\Alias;
  7. use Symfony\Component\DependencyInjection\ContainerBuilder;
  8. use Symfony\Component\DependencyInjection\Extension\Extension;
  9. use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
  10. use Symfony\Component\DependencyInjection\Reference;
  11. class AsyncEventDispatcherExtension extends Extension
  12. {
  13.     public function load(array $configsContainerBuilder $container)
  14.     {
  15.         $config $this->processConfiguration(new Configuration(), $configs);
  16.         $container->setAlias('enqueue.events.context', new Alias($config['context_service'], true));
  17.         $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
  18.         $loader->load('services.yml');
  19.         $container->register('enqueue.events.async_processor'AsyncProcessor::class)
  20.             ->addArgument(new Reference('enqueue.events.registry'))
  21.             ->addArgument(new Reference('enqueue.events.event_dispatcher'))
  22.             ->addTag('enqueue.processor', [
  23.                 'command' => Commands::DISPATCH_ASYNC_EVENTS,
  24.                 'queue' => '%enqueue_events_queue%',
  25.                 'prefix_queue' => false,
  26.                 'exclusive' => true,
  27.             ])
  28.             ->addTag('enqueue.transport.processor')
  29.         ;
  30.     }
  31. }