Skip to content

Commit 1ad8a79

Browse files
committed
Update enqueue architecture. Get rid of meta (queue|topic), rely one routes.
1 parent 9f2993f commit 1ad8a79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1489
-1423
lines changed

pkg/enqueue/Client/ArrayProcessorRegistry.php

+2-9
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,12 @@ public function __construct(array $processors = [])
1919
$this->processors = $processors;
2020
}
2121

22-
/**
23-
* @param string $name
24-
* @param PsrProcessor $processor
25-
*/
26-
public function add($name, PsrProcessor $processor)
22+
public function add(string $name, PsrProcessor $processor): void
2723
{
2824
$this->processors[$name] = $processor;
2925
}
3026

31-
/**
32-
* {@inheritdoc}
33-
*/
34-
public function get($processorName)
27+
public function get(string $processorName): PsrProcessor
3528
{
3629
if (false == isset($this->processors[$processorName])) {
3730
throw new \LogicException(sprintf('Processor was not found. processorName: "%s"', $processorName));

pkg/enqueue/Client/ChainExtension.php

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ final class ChainExtension implements ExtensionInterface
1414
*/
1515
public function __construct(array $extensions)
1616
{
17+
$this->extensions = [];
1718
array_walk($extensions, function (ExtensionInterface $extension) {
1819
$this->extensions[] = $extension;
1920
});

pkg/enqueue/Client/CommandSubscriberInterface.php

+25-4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,34 @@ interface CommandSubscriberInterface
1212
* or
1313
*
1414
* [
15-
* 'processorName' => 'aCommandName',
16-
* 'queueName' => 'a_client_queue_name',
17-
* 'queueNameHardcoded' => true,
15+
* 'command' => 'aSubscribedCommand',
16+
* 'processor' => 'aProcessorName',
17+
* 'queue' => 'a_client_queue_name',
18+
* 'prefix_queue' => true,
1819
* 'exclusive' => true,
1920
* ]
2021
*
21-
* queueName, exclusive and queueNameHardcoded are optional.
22+
* or
23+
*
24+
* [
25+
* [
26+
* 'command' => 'aSubscribedCommand',
27+
* 'processor' => 'aProcessorName',
28+
* 'queue' => 'a_client_queue_name',
29+
* 'prefix_queue' => true,
30+
* 'exclusive' => true,
31+
* ],
32+
* [
33+
* 'command' => 'aSubscribedCommand',
34+
* 'processor' => 'aProcessorName',
35+
* 'queue' => 'a_client_queue_name',
36+
* 'prefix_queue' => true,
37+
* 'exclusive' => true,
38+
* ]
39+
* ]
40+
*
41+
* queue, processor, prefix_queue, and exclusive are optional.
42+
* It is possible to pass other options, they could be accessible on a route instance through options.
2243
*
2344
* Note: If you set queueNameHardcoded to true then the queueName is used as is and therefor the driver is not used to create a transport queue name.
2445
*

pkg/enqueue/Client/Driver/GenericDriver.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ public function setupBroker(LoggerInterface $logger = null): void
117117
{
118118
}
119119

120-
public function createQueue(string $clientQueueName): PsrQueue
120+
public function createQueue(string $clientQueueName, bool $prefix = true): PsrQueue
121121
{
122-
$transportName = $this->createTransportQueueName($clientQueueName, true);
122+
$transportName = $this->createTransportQueueName($clientQueueName, $prefix);
123123

124124
return $this->doCreateQueue($transportName);
125125
}

pkg/enqueue/Client/DriverInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function sendToRouter(Message $message): void;
1919

2020
public function sendToProcessor(Message $message): void;
2121

22-
public function createQueue(string $queueName): PsrQueue;
22+
public function createQueue(string $queueName, bool $prefix = true): PsrQueue;
2323

2424
public function createRouteQueue(Route $route): PsrQueue;
2525

pkg/enqueue/Client/Meta/QueueMeta.php

-57
This file was deleted.

pkg/enqueue/Client/Meta/QueueMetaRegistry.php

-95
This file was deleted.

pkg/enqueue/Client/Meta/TopicMeta.php

-57
This file was deleted.

pkg/enqueue/Client/Meta/TopicMetaRegistry.php

-80
This file was deleted.

pkg/enqueue/Client/ProcessorRegistryInterface.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,5 @@
66

77
interface ProcessorRegistryInterface
88
{
9-
/**
10-
* @param string $processorName
11-
*
12-
* @return PsrProcessor
13-
*/
14-
public function get($processorName);
9+
public function get(string $processorName): PsrProcessor;
1510
}

0 commit comments

Comments
 (0)