@@ -33,7 +33,8 @@ discard block |
||
| 33 | 33 | // Replaces alias with real pipeline name |
| 34 | 34 | $name = $this->config->getAliases()[$name] ?? $name; |
| 35 | 35 | |
| 36 | - if (!isset($this->pipelines[$name])) { |
|
| 36 | + if (!isset($this->pipelines[$name])) |
|
| 37 | + { |
|
| 37 | 38 | $this->pipelines[$name] = $this->resolveConnection($name); |
| 38 | 39 | } |
| 39 | 40 | |
@@ -48,7 +49,8 @@ discard block |
||
| 48 | 49 | { |
| 49 | 50 | $config = $this->config->getConnection($name); |
| 50 | 51 | |
| 51 | - try { |
|
| 52 | + try |
|
| 53 | + { |
|
| 52 | 54 | $driver = $this->factory->make($config['driver'], $config); |
| 53 | 55 | |
| 54 | 56 | $core = new InterceptableCore( |
@@ -56,8 +58,10 @@ discard block |
||
| 56 | 58 | $this->dispatcher |
| 57 | 59 | ); |
| 58 | 60 | |
| 59 | - foreach ($this->config->getPushInterceptors() as $interceptor) { |
|
| 60 | - if (\is_string($interceptor) || $interceptor instanceof Autowire) { |
|
| 61 | + foreach ($this->config->getPushInterceptors() as $interceptor) |
|
| 62 | + { |
|
| 63 | + if (\is_string($interceptor) || $interceptor instanceof Autowire) |
|
| 64 | + { |
|
| 61 | 65 | $interceptor = $this->container->get($interceptor); |
| 62 | 66 | } |
| 63 | 67 | |
@@ -66,7 +70,9 @@ discard block |
||
| 66 | 70 | } |
| 67 | 71 | |
| 68 | 72 | return new Queue($core); |
| 69 | - } catch (ContainerException $e) { |
|
| 73 | + } |
|
| 74 | + catch (ContainerException $e) |
|
| 75 | + { |
|
| 70 | 76 | throw new Exception\NotSupportedDriverException( |
| 71 | 77 | \sprintf( |
| 72 | 78 | 'Driver `%s` is not supported. Connection `%s` cannot be created. Reason: `%s`', |
@@ -66,11 +66,13 @@ discard block |
||
| 66 | 66 | $registry = $container->get(QueueRegistry::class); |
| 67 | 67 | $config = $container->get(QueueConfig::class); |
| 68 | 68 | |
| 69 | - foreach ($config->getRegistryHandlers() as $jobType => $handler) { |
|
| 69 | + foreach ($config->getRegistryHandlers() as $jobType => $handler) |
|
| 70 | + { |
|
| 70 | 71 | $registry->setHandler($jobType, $handler); |
| 71 | 72 | } |
| 72 | 73 | |
| 73 | - foreach ($config->getRegistrySerializers() as $jobType => $serializer) { |
|
| 74 | + foreach ($config->getRegistrySerializers() as $jobType => $serializer) |
|
| 75 | + { |
|
| 74 | 76 | $registry->setSerializer($jobType, $serializer); |
| 75 | 77 | } |
| 76 | 78 | }); |
@@ -128,10 +130,14 @@ discard block |
||
| 128 | 130 | ): Handler { |
| 129 | 131 | $core = new InterceptableCore($core, $dispatcher); |
| 130 | 132 | |
| 131 | - foreach ($config->getConsumeInterceptors() as $interceptor) { |
|
| 132 | - if (\is_string($interceptor)) { |
|
| 133 | + foreach ($config->getConsumeInterceptors() as $interceptor) |
|
| 134 | + { |
|
| 135 | + if (\is_string($interceptor)) |
|
| 136 | + { |
|
| 133 | 137 | $interceptor = $container->get($interceptor); |
| 134 | - } elseif ($interceptor instanceof Autowire) { |
|
| 138 | + } |
|
| 139 | + elseif ($interceptor instanceof Autowire) |
|
| 140 | + { |
|
| 135 | 141 | $interceptor = $interceptor->resolve($factory); |
| 136 | 142 | } |
| 137 | 143 | |
@@ -88,7 +88,8 @@ |
||
| 88 | 88 | var_dump($name); |
| 89 | 89 | $result = ['sync' => $this->defaultQueue, 'test' => $this->testQueue][$name] ?? null; |
| 90 | 90 | |
| 91 | - if ($result === null) { |
|
| 91 | + if ($result === null) |
|
| 92 | + { |
|
| 92 | 93 | throw new NotFoundException(); |
| 93 | 94 | } |
| 94 | 95 | return $result; |
@@ -23,19 +23,28 @@ |
||
| 23 | 23 | |
| 24 | 24 | public function createInjection(ReflectionClass $class, string $context = null): QueueInterface |
| 25 | 25 | { |
| 26 | - try { |
|
| 27 | - if ($context === null) { |
|
| 26 | + try |
|
| 27 | + { |
|
| 28 | + if ($context === null) |
|
| 29 | + { |
|
| 28 | 30 | $connection = $this->queueManager->getConnection(); |
| 29 | - } else { |
|
| 31 | + } |
|
| 32 | + else |
|
| 33 | + { |
|
| 30 | 34 | // Get Queue by context |
| 31 | - try { |
|
| 35 | + try |
|
| 36 | + { |
|
| 32 | 37 | $connection = $this->queueManager->getConnection($context); |
| 33 | - } catch (InvalidArgumentException) { |
|
| 38 | + } |
|
| 39 | + catch (InvalidArgumentException) |
|
| 40 | + { |
|
| 34 | 41 | // Case when context doesn't match to configured connections |
| 35 | 42 | return $this->queueManager->getConnection(); |
| 36 | 43 | } |
| 37 | 44 | } |
| 38 | - } catch (\Throwable $e) { |
|
| 45 | + } |
|
| 46 | + catch (\Throwable $e) |
|
| 47 | + { |
|
| 39 | 48 | throw new ContainerException(\sprintf("Can't inject the required queue. %s", $e->getMessage()), 0, $e); |
| 40 | 49 | } |
| 41 | 50 | |