From 83434680087e187df5eac5b470f05d4536b4ecf8 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Fri, 28 Sep 2018 19:00:31 +0300 Subject: [PATCH 1/4] Merge master --- .../DependencyInjection/Configuration.php | 6 +- .../Tests/Functional/Client/ProducerTest.php | 12 ++-- pkg/enqueue/Client/Config.php | 37 ++-------- .../ExclusiveCommandExtension.php | 10 +-- .../SetRouterPropertiesExtension.php | 4 +- pkg/enqueue/Client/DelegateProcessor.php | 4 +- pkg/enqueue/Client/Driver/GenericDriver.php | 18 ++--- .../Client/Driver/RabbitMqStompDriver.php | 4 +- pkg/enqueue/Client/DriverPreSend.php | 8 +-- pkg/enqueue/Client/PostSend.php | 8 +-- pkg/enqueue/Client/Producer.php | 8 +-- pkg/enqueue/Client/RouterProcessor.php | 10 +-- pkg/enqueue/Tests/Client/ConfigTest.php | 70 ------------------- .../ExclusiveCommandExtensionTest.php | 16 ++--- .../SetRouterPropertiesExtensionTest.php | 6 +- .../Tests/Client/DelegateProcessorTest.php | 4 +- .../Tests/Client/Driver/AmqpDriverTest.php | 2 +- .../Client/Driver/GenericDriverTestsTrait.php | 64 ++++++++--------- .../Client/Driver/RabbitMqStompDriverTest.php | 4 +- .../Tests/Client/DriverPreSendTest.php | 4 +- pkg/enqueue/Tests/Client/PostSendTest.php | 4 +- .../Tests/Client/ProducerSendCommandTest.php | 14 ++-- .../Tests/Client/ProducerSendEventTest.php | 16 ++--- .../Tests/Client/RouterProcessorTest.php | 25 +++---- pkg/fs/Tests/Functional/FsConsumerTest.php | 8 +-- pkg/simple-client/SimpleClient.php | 6 +- 26 files changed, 135 insertions(+), 237 deletions(-) diff --git a/pkg/enqueue-bundle/DependencyInjection/Configuration.php b/pkg/enqueue-bundle/DependencyInjection/Configuration.php index 851f95210..ce2c62bde 100644 --- a/pkg/enqueue-bundle/DependencyInjection/Configuration.php +++ b/pkg/enqueue-bundle/DependencyInjection/Configuration.php @@ -35,10 +35,10 @@ public function getConfigTreeBuilder(): TreeBuilder ->booleanNode('traceable_producer')->defaultValue($this->debug)->end() ->scalarNode('prefix')->defaultValue('enqueue')->end() ->scalarNode('app_name')->defaultValue('app')->end() - ->scalarNode('router_topic')->defaultValue(Config::DEFAULT_PROCESSOR_QUEUE_NAME)->cannotBeEmpty()->end() - ->scalarNode('router_queue')->defaultValue(Config::DEFAULT_PROCESSOR_QUEUE_NAME)->cannotBeEmpty()->end() + ->scalarNode('router_topic')->defaultValue('default')->cannotBeEmpty()->end() + ->scalarNode('router_queue')->defaultValue('default')->cannotBeEmpty()->end() ->scalarNode('router_processor')->defaultValue(RouterProcessor::class)->end() - ->scalarNode('default_processor_queue')->defaultValue(Config::DEFAULT_PROCESSOR_QUEUE_NAME)->cannotBeEmpty()->end() + ->scalarNode('default_processor_queue')->defaultValue('default')->cannotBeEmpty()->end() ->integerNode('redelivered_delay_time')->min(0)->defaultValue(0)->end() ->end()->end() ->arrayNode('consumption')->addDefaultsIfNotSet()->children() diff --git a/pkg/enqueue-bundle/Tests/Functional/Client/ProducerTest.php b/pkg/enqueue-bundle/Tests/Functional/Client/ProducerTest.php index e86eb840d..51db9dc25 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Client/ProducerTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Client/ProducerTest.php @@ -72,8 +72,8 @@ public function testShouldSendMessageInstanceAsCommandWithoutNeedForReply() $this->assertCount(1, $traces); $this->assertEquals('theMessage', $traces[0]['body']); $this->assertEquals([ - 'enqueue.processor_name' => 'test_command_subscriber_processor', - 'enqueue.command_name' => 'theCommand', + 'enqueue.processor' => 'test_command_subscriber_processor', + 'enqueue.command' => 'theCommand', ], $traces[0]['properties']); } @@ -93,8 +93,8 @@ public function testShouldSendExclusiveCommandWithNeedForReply() $this->assertCount(1, $traces); $this->assertEquals('theMessage', $traces[0]['body']); $this->assertEquals([ - 'enqueue.processor_name' => 'theExclusiveCommandName', - 'enqueue.command_name' => 'theExclusiveCommandName', + 'enqueue.processor' => 'theExclusiveCommandName', + 'enqueue.command' => 'theExclusiveCommandName', ], $traces[0]['properties']); } @@ -114,8 +114,8 @@ public function testShouldSendMessageInstanceCommandWithNeedForReply() $this->assertCount(1, $traces); $this->assertEquals('theMessage', $traces[0]['body']); $this->assertEquals([ - 'enqueue.processor_name' => 'test_command_subscriber_processor', - 'enqueue.command_name' => 'theCommand', + 'enqueue.processor' => 'test_command_subscriber_processor', + 'enqueue.command' => 'theCommand', ], $traces[0]['properties']); } diff --git a/pkg/enqueue/Client/Config.php b/pkg/enqueue/Client/Config.php index f85d25de4..07bd3e0ea 100644 --- a/pkg/enqueue/Client/Config.php +++ b/pkg/enqueue/Client/Config.php @@ -4,21 +4,12 @@ class Config { - const PARAMETER_TOPIC_NAME = 'enqueue.topic_name'; - const PARAMETER_COMMAND_NAME = 'enqueue.command_name'; - const PARAMETER_PROCESSOR_NAME = 'enqueue.processor_name'; - - /** - * @deprecated - */ - const PARAMETER_PROCESSOR_QUEUE_NAME = 'enqueue.processor_queue_name'; - - const DEFAULT_PROCESSOR_QUEUE_NAME = 'default'; - - /** - * @deprecated - */ - const COMMAND_TOPIC = '__command__'; + const TOPIC_PARAMETER = 'enqueue.topic'; + const COMMAND_PARAMETER = 'enqueue.command'; + const PROCESSOR_PARAMETER = 'enqueue.processor'; + const EXPIRE_PARAMETER = 'enqueue.expire'; + const PRIORITY_PARAMETER = 'enqueue.priority'; + const DELAY_PARAMETER = 'enqueue.delay'; /** * @var string @@ -118,22 +109,6 @@ public function getRouterProcessorName(): string return $this->routerProcessorName; } - /** - * @deprecated - */ - public function createTransportRouterTopicName(string $name): string - { - return strtolower(implode('.', array_filter([trim($this->prefix), trim($name)]))); - } - - /** - * @deprecated - */ - public function createTransportQueueName(string $name): string - { - return strtolower(implode('.', array_filter([trim($this->prefix), trim($this->appName), trim($name)]))); - } - /** * @deprecated * diff --git a/pkg/enqueue/Client/ConsumptionExtension/ExclusiveCommandExtension.php b/pkg/enqueue/Client/ConsumptionExtension/ExclusiveCommandExtension.php index 64a2d45e4..2ebd8a6db 100644 --- a/pkg/enqueue/Client/ConsumptionExtension/ExclusiveCommandExtension.php +++ b/pkg/enqueue/Client/ConsumptionExtension/ExclusiveCommandExtension.php @@ -33,13 +33,13 @@ public function onPreReceived(Context $context) $message = $context->getInteropMessage(); $queue = $context->getInteropQueue(); - if ($message->getProperty(Config::PARAMETER_TOPIC_NAME)) { + if ($message->getProperty(Config::TOPIC_PARAMETER)) { return; } - if ($message->getProperty(Config::PARAMETER_COMMAND_NAME)) { + if ($message->getProperty(Config::COMMAND_PARAMETER)) { return; } - if ($message->getProperty(Config::PARAMETER_PROCESSOR_NAME)) { + if ($message->getProperty(Config::PROCESSOR_PARAMETER)) { return; } @@ -51,8 +51,8 @@ public function onPreReceived(Context $context) $context->getLogger()->debug('[ExclusiveCommandExtension] This is a exclusive command queue and client\'s properties are not set. Setting them'); $route = $this->queueToRouteMap[$queue->getQueueName()]; - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, $route->getProcessor()); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, $route->getSource()); + $message->setProperty(Config::PROCESSOR_PARAMETER, $route->getProcessor()); + $message->setProperty(Config::COMMAND_PARAMETER, $route->getSource()); } } diff --git a/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php b/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php index 0b91834b5..d5c3cee41 100644 --- a/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php +++ b/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php @@ -28,7 +28,7 @@ public function __construct(DriverInterface $driver) public function onPreReceived(Context $context) { $message = $context->getInteropMessage(); - if ($message->getProperty(Config::PARAMETER_PROCESSOR_NAME)) { + if ($message->getProperty(Config::PROCESSOR_PARAMETER)) { return; } @@ -39,7 +39,7 @@ public function onPreReceived(Context $context) } // RouterProcessor is our default message processor when that header is not set - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, $config->getRouterProcessorName()); + $message->setProperty(Config::PROCESSOR_PARAMETER, $config->getRouterProcessorName()); $context->getLogger()->debug( '[SetRouterPropertiesExtension] '. diff --git a/pkg/enqueue/Client/DelegateProcessor.php b/pkg/enqueue/Client/DelegateProcessor.php index 299668443..920c4afd0 100644 --- a/pkg/enqueue/Client/DelegateProcessor.php +++ b/pkg/enqueue/Client/DelegateProcessor.php @@ -26,11 +26,11 @@ public function __construct(ProcessorRegistryInterface $registry) */ public function process(InteropMessage $message, Context $context) { - $processorName = $message->getProperty(Config::PARAMETER_PROCESSOR_NAME); + $processorName = $message->getProperty(Config::PROCESSOR_PARAMETER); if (false == $processorName) { throw new \LogicException(sprintf( 'Got message without required parameter: "%s"', - Config::PARAMETER_PROCESSOR_NAME + Config::PROCESSOR_PARAMETER )); } diff --git a/pkg/enqueue/Client/Driver/GenericDriver.php b/pkg/enqueue/Client/Driver/GenericDriver.php index 639146654..627e63e7d 100644 --- a/pkg/enqueue/Client/Driver/GenericDriver.php +++ b/pkg/enqueue/Client/Driver/GenericDriver.php @@ -47,10 +47,10 @@ public function __construct( public function sendToRouter(Message $message): void { - if ($message->getProperty(Config::PARAMETER_COMMAND_NAME)) { + if ($message->getProperty(Config::COMMAND_PARAMETER)) { throw new \LogicException('Command must not be send to router but go directly to its processor.'); } - if (false == $message->getProperty(Config::PARAMETER_TOPIC_NAME)) { + if (false == $message->getProperty(Config::TOPIC_PARAMETER)) { throw new \LogicException('Topic name parameter is required but is not set'); } @@ -63,21 +63,21 @@ public function sendToRouter(Message $message): void public function sendToProcessor(Message $message): void { - $topic = $message->getProperty(Config::PARAMETER_TOPIC_NAME); - $command = $message->getProperty(Config::PARAMETER_COMMAND_NAME); + $topic = $message->getProperty(Config::TOPIC_PARAMETER); + $command = $message->getProperty(Config::COMMAND_PARAMETER); /** @var InteropQueue $queue */ $queue = null; - if ($topic && $processor = $message->getProperty(Config::PARAMETER_PROCESSOR_NAME)) { + if ($topic && $processor = $message->getProperty(Config::PROCESSOR_PARAMETER)) { $route = $this->routeCollection->topicAndProcessor($topic, $processor); if (false == $route) { throw new \LogicException(sprintf('There is no route for topic "%s" and processor "%s"', $topic, $processor)); } - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, $route->getProcessor()); + $message->setProperty(Config::PROCESSOR_PARAMETER, $route->getProcessor()); $queue = $this->createRouteQueue($route); - } elseif ($topic && false == $message->getProperty(Config::PARAMETER_PROCESSOR_NAME)) { - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, $this->config->getRouterProcessorName()); + } elseif ($topic && false == $message->getProperty(Config::PROCESSOR_PARAMETER)) { + $message->setProperty(Config::PROCESSOR_PARAMETER, $this->config->getRouterProcessorName()); $queue = $this->createQueue($this->config->getRouterQueueName()); } elseif ($command) { @@ -86,7 +86,7 @@ public function sendToProcessor(Message $message): void throw new \LogicException(sprintf('There is no route for command "%s".', $command)); } - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, $route->getProcessor()); + $message->setProperty(Config::PROCESSOR_PARAMETER, $route->getProcessor()); $queue = $this->createRouteQueue($route); } else { throw new \LogicException('Either topic or command parameter must be set.'); diff --git a/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php b/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php index fc15953c8..77b4293c0 100644 --- a/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php +++ b/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php @@ -76,7 +76,7 @@ public function setupBroker(LoggerInterface $logger = null): void } // setup router - $routerExchange = $this->getConfig()->createTransportRouterTopicName($this->getConfig()->getRouterTopicName()); + $routerExchange = $this->createTransportRouterTopicName($this->getConfig()->getRouterTopicName(), true); $log('Declare router exchange: %s', $routerExchange); $this->management->declareExchange($routerExchange, [ 'type' => 'fanout', @@ -84,7 +84,7 @@ public function setupBroker(LoggerInterface $logger = null): void 'auto_delete' => false, ]); - $routerQueue = $this->getConfig()->createTransportQueueName($this->getConfig()->getRouterQueueName()); + $routerQueue = $this->createTransportQueueName($this->getConfig()->getRouterQueueName(), true); $log('Declare router queue: %s', $routerQueue); $this->management->declareQueue($routerQueue, [ 'auto_delete' => false, diff --git a/pkg/enqueue/Client/DriverPreSend.php b/pkg/enqueue/Client/DriverPreSend.php index d940fc023..8a92fd964 100644 --- a/pkg/enqueue/Client/DriverPreSend.php +++ b/pkg/enqueue/Client/DriverPreSend.php @@ -34,21 +34,21 @@ public function getDriver(): DriverInterface public function isEvent(): bool { - return (bool) $this->message->getProperty(Config::PARAMETER_TOPIC_NAME); + return (bool) $this->message->getProperty(Config::TOPIC_PARAMETER); } public function isCommand(): bool { - return (bool) $this->message->getProperty(Config::PARAMETER_COMMAND_NAME); + return (bool) $this->message->getProperty(Config::COMMAND_PARAMETER); } public function getCommand(): string { - return $this->message->getProperty(Config::PARAMETER_COMMAND_NAME); + return $this->message->getProperty(Config::COMMAND_PARAMETER); } public function getTopic(): string { - return $this->message->getProperty(Config::PARAMETER_TOPIC_NAME); + return $this->message->getProperty(Config::TOPIC_PARAMETER); } } diff --git a/pkg/enqueue/Client/PostSend.php b/pkg/enqueue/Client/PostSend.php index 5f575e2a6..5cfafb397 100644 --- a/pkg/enqueue/Client/PostSend.php +++ b/pkg/enqueue/Client/PostSend.php @@ -34,21 +34,21 @@ public function getDriver(): DriverInterface public function isEvent(): bool { - return (bool) $this->message->getProperty(Config::PARAMETER_TOPIC_NAME); + return (bool) $this->message->getProperty(Config::TOPIC_PARAMETER); } public function isCommand(): bool { - return (bool) $this->message->getProperty(Config::PARAMETER_COMMAND_NAME); + return (bool) $this->message->getProperty(Config::COMMAND_PARAMETER); } public function getCommand(): string { - return $this->message->getProperty(Config::PARAMETER_COMMAND_NAME); + return $this->message->getProperty(Config::COMMAND_PARAMETER); } public function getTopic(): string { - return $this->message->getProperty(Config::PARAMETER_TOPIC_NAME); + return $this->message->getProperty(Config::TOPIC_PARAMETER); } } diff --git a/pkg/enqueue/Client/Producer.php b/pkg/enqueue/Client/Producer.php index 977b4b577..e6aae73a6 100644 --- a/pkg/enqueue/Client/Producer.php +++ b/pkg/enqueue/Client/Producer.php @@ -48,7 +48,7 @@ public function sendEvent(string $topic, $message): void $this->extension->onPreSendEvent($preSend); $message = $preSend->getMessage(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, $preSend->getTopic()); + $message->setProperty(Config::TOPIC_PARAMETER, $preSend->getTopic()); $this->doSend($message); } @@ -79,7 +79,7 @@ public function sendCommand(string $command, $message, bool $needReply = false): } } - $message->setProperty(Config::PARAMETER_COMMAND_NAME, $command); + $message->setProperty(Config::COMMAND_PARAMETER, $command); $message->setScope(Message::SCOPE_APP); $this->doSend($message); @@ -103,8 +103,8 @@ private function doSend(Message $message): void )); } - if ($message->getProperty(Config::PARAMETER_PROCESSOR_NAME)) { - throw new \LogicException(sprintf('The %s property must not be set.', Config::PARAMETER_PROCESSOR_NAME)); + if ($message->getProperty(Config::PROCESSOR_PARAMETER)) { + throw new \LogicException(sprintf('The %s property must not be set.', Config::PROCESSOR_PARAMETER)); } if (!$message->getMessageId()) { diff --git a/pkg/enqueue/Client/RouterProcessor.php b/pkg/enqueue/Client/RouterProcessor.php index d106e29ec..220d8ecf9 100644 --- a/pkg/enqueue/Client/RouterProcessor.php +++ b/pkg/enqueue/Client/RouterProcessor.php @@ -21,22 +21,22 @@ public function __construct(DriverInterface $driver) public function process(InteropMessage $message, Context $context): Result { - if ($message->getProperty(Config::PARAMETER_COMMAND_NAME)) { + if ($message->getProperty(Config::COMMAND_PARAMETER)) { return Result::reject(sprintf( 'Unexpected command "%s" got. Command must not go to the router.', - $message->getProperty(Config::PARAMETER_COMMAND_NAME) + $message->getProperty(Config::COMMAND_PARAMETER) )); } - $topic = $message->getProperty(Config::PARAMETER_TOPIC_NAME); + $topic = $message->getProperty(Config::TOPIC_PARAMETER); if (false == $topic) { - return Result::reject(sprintf('Topic property "%s" is required but not set or empty.', Config::PARAMETER_TOPIC_NAME)); + return Result::reject(sprintf('Topic property "%s" is required but not set or empty.', Config::TOPIC_PARAMETER)); } $count = 0; foreach ($this->driver->getRouteCollection()->topic($topic) as $route) { $clientMessage = $this->driver->createClientMessage($message); - $clientMessage->setProperty(Config::PARAMETER_PROCESSOR_NAME, $route->getProcessor()); + $clientMessage->setProperty(Config::PROCESSOR_PARAMETER, $route->getProcessor()); $this->driver->sendToProcessor($clientMessage); diff --git a/pkg/enqueue/Tests/Client/ConfigTest.php b/pkg/enqueue/Tests/Client/ConfigTest.php index d616b5629..e130319de 100644 --- a/pkg/enqueue/Tests/Client/ConfigTest.php +++ b/pkg/enqueue/Tests/Client/ConfigTest.php @@ -125,76 +125,6 @@ public function testShouldReturnDefaultQueueNameSetInConstructor() $this->assertEquals('aDefaultQueueName', $config->getDefaultProcessorQueueName()); } - public function testShouldCreateRouterTopicName() - { - $config = new Config( - 'aPrefix', - 'aApp', - 'aRouterTopicName', - 'aRouterQueueName', - 'aDefaultQueueName', - 'aRouterProcessorName' - ); - - $this->assertEquals('aprefix.aname', $config->createTransportRouterTopicName('aName')); - } - - public function testShouldCreateProcessorQueueName() - { - $config = new Config( - 'aPrefix', - 'aApp', - 'aRouterTopicName', - 'aRouterQueueName', - 'aDefaultQueueName', - 'aRouterProcessorName' - ); - - $this->assertEquals('aprefix.aapp.aname', $config->createTransportQueueName('aName')); - } - - public function testShouldCreateProcessorQueueNameWithoutAppName() - { - $config = new Config( - 'aPrefix', - '', - 'aRouterTopicName', - 'aRouterQueueName', - 'aDefaultQueueName', - 'aRouterProcessorName' - ); - - $this->assertEquals('aprefix.aname', $config->createTransportQueueName('aName')); - } - - public function testShouldCreateProcessorQueueNameWithoutPrefix() - { - $config = new Config( - '', - 'aApp', - 'aRouterTopicName', - 'aRouterQueueName', - 'aDefaultQueueName', - 'aRouterProcessorName' - ); - - $this->assertEquals('aapp.aname', $config->createTransportQueueName('aName')); - } - - public function testShouldCreateProcessorQueueNameWithoutPrefixAndAppName() - { - $config = new Config( - '', - '', - 'aRouterTopicName', - 'aRouterQueueName', - 'aDefaultQueueName', - 'aRouterProcessorName' - ); - - $this->assertEquals('aname', $config->createTransportQueueName('aName')); - } - public function testShouldCreateDefaultConfig() { $config = Config::create(); diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php index ff10c803c..63433712f 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php @@ -38,7 +38,7 @@ public function testCouldBeConstructedWithDriverAsFirstArgument() public function testShouldDoNothingIfMessageHasTopicPropertySetOnPreReceive() { $message = new NullMessage(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'aTopic'); + $message->setProperty(Config::TOPIC_PARAMETER, 'aTopic'); $context = new Context(new NullContext()); $context->setInteropMessage($message); @@ -56,14 +56,14 @@ public function testShouldDoNothingIfMessageHasTopicPropertySetOnPreReceive() self::assertNull($context->getResult()); $this->assertEquals([ - 'enqueue.topic_name' => 'aTopic', + 'enqueue.topic' => 'aTopic', ], $message->getProperties()); } public function testShouldDoNothingIfMessageHasCommandPropertySetOnPreReceive() { $message = new NullMessage(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'aCommand'); + $message->setProperty(Config::COMMAND_PARAMETER, 'aCommand'); $context = new Context(new NullContext()); $context->setInteropMessage($message); @@ -81,14 +81,14 @@ public function testShouldDoNothingIfMessageHasCommandPropertySetOnPreReceive() self::assertNull($context->getResult()); $this->assertEquals([ - 'enqueue.command_name' => 'aCommand', + 'enqueue.command' => 'aCommand', ], $message->getProperties()); } public function testShouldDoNothingIfMessageHasProcessorPropertySetOnPreReceive() { $message = new NullMessage(); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'aProcessor'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'aProcessor'); $context = new Context(new NullContext()); $context->setInteropMessage($message); @@ -106,7 +106,7 @@ public function testShouldDoNothingIfMessageHasProcessorPropertySetOnPreReceive( self::assertNull($context->getResult()); $this->assertEquals([ - 'enqueue.processor_name' => 'aProcessor', + 'enqueue.processor' => 'aProcessor', ], $message->getProperties()); } @@ -164,8 +164,8 @@ public function testShouldSetCommandPropertiesIfCurrentQueueHasExclusiveCommandP self::assertNull($context->getResult()); $this->assertEquals([ - 'enqueue.processor_name' => 'theFooProcessor', - 'enqueue.command_name' => 'fooCommand', + 'enqueue.processor' => 'theFooProcessor', + 'enqueue.command' => 'fooCommand', ], $message->getProperties()); } diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php index 395042a3d..e4ae8a658 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php @@ -57,7 +57,7 @@ public function testShouldSetRouterProcessorPropertyIfNotSetAndOnRouterQueue() $extension->onPreReceived($context); $this->assertEquals([ - 'enqueue.processor_name' => 'router-processor-name', + 'enqueue.processor' => 'router-processor-name', ], $message->getProperties()); } @@ -100,7 +100,7 @@ public function testShouldNotSetAnyPropertyIfProcessorNamePropertyAlreadySet() ; $message = new NullMessage(); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'non-router-processor'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'non-router-processor'); $context = new Context($this->createContextMock()); $context->setInteropMessage($message); @@ -109,7 +109,7 @@ public function testShouldNotSetAnyPropertyIfProcessorNamePropertyAlreadySet() $extension->onPreReceived($context); $this->assertEquals([ - 'enqueue.processor_name' => 'non-router-processor', + 'enqueue.processor' => 'non-router-processor', ], $message->getProperties()); } diff --git a/pkg/enqueue/Tests/Client/DelegateProcessorTest.php b/pkg/enqueue/Tests/Client/DelegateProcessorTest.php index 4bf688f7b..424206827 100644 --- a/pkg/enqueue/Tests/Client/DelegateProcessorTest.php +++ b/pkg/enqueue/Tests/Client/DelegateProcessorTest.php @@ -21,7 +21,7 @@ public function testShouldThrowExceptionIfProcessorNameIsNotSet() { $this->setExpectedException( \LogicException::class, - 'Got message without required parameter: "enqueue.processor_name"' + 'Got message without required parameter: "enqueue.processor"' ); $processor = new DelegateProcessor($this->createProcessorRegistryMock()); @@ -33,7 +33,7 @@ public function testShouldProcessMessage() $session = $this->createContextMock(); $message = new NullMessage(); $message->setProperties([ - Config::PARAMETER_PROCESSOR_NAME => 'processor-name', + Config::PROCESSOR_PARAMETER => 'processor-name', ]); $processor = $this->createProcessorMock(); diff --git a/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php b/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php index 11539cb06..e7d76e287 100644 --- a/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php @@ -170,7 +170,7 @@ public function testShouldResetPriorityAndExpirationAndNeverCallProducerDelivery ); $message = new Message(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); $message->setExpire(123); $message->setPriority(MessagePriority::HIGH); diff --git a/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php b/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php index 46c308b26..782add3be 100644 --- a/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php +++ b/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php @@ -284,7 +284,7 @@ public function testShouldSendMessageToRouter() ); $message = new Message(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); $driver->sendToRouter($message); } @@ -323,7 +323,7 @@ public function testShouldNotInitDeliveryDelayOnSendMessageToRouter() $message = new Message(); $message->setDelay(456); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); $driver->sendToRouter($message); } @@ -362,7 +362,7 @@ public function testShouldNotInitTimeToLiveOnSendMessageToRouter() $message = new Message(); $message->setExpire(456); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); $driver->sendToRouter($message); } @@ -401,7 +401,7 @@ public function testShouldNotInitPriorityOnSendMessageToRouter() $message = new Message(); $message->setPriority(MessagePriority::HIGH); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); $driver->sendToRouter($message); } @@ -429,7 +429,7 @@ public function testThrowIfCommandSetOnSendToRouter() ); $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'aCommand'); + $message->setProperty(Config::COMMAND_PARAMETER, 'aCommand'); $this->expectException(\LogicException::class); $this->expectExceptionMessage('Command must not be send to router but go directly to its processor.'); @@ -475,8 +475,8 @@ public function testShouldSendTopicMessageToProcessorToDefaultQueue() ); $message = new Message(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $driver->sendToProcessor($message); } @@ -519,8 +519,8 @@ public function testShouldSendTopicMessageToProcessorToCustomQueue() ); $message = new Message(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $driver->sendToProcessor($message); } @@ -569,8 +569,8 @@ public function testShouldInitDeliveryDelayIfDelayPropertyOnSendToProcessor() $message = new Message(); $message->setDelay(456); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $driver->sendToProcessor($message); } @@ -619,8 +619,8 @@ public function testShouldSetInitTimeToLiveIfExpirePropertyOnSendToProcessor() $message = new Message(); $message->setExpire(678); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $driver->sendToProcessor($message); } @@ -669,8 +669,8 @@ public function testShouldSetInitPriorityIfPriorityPropertyOnSendToProcessor() $message = new Message(); $message->setPriority(MessagePriority::HIGH); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $driver->sendToProcessor($message); } @@ -694,8 +694,8 @@ public function testThrowIfNoRouteFoundForTopicMessageOnSendToProcessor() ); $message = new Message(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $this->expectException(\LogicException::class); $this->expectExceptionMessage('There is no route for topic "topic" and processor "processor"'); @@ -740,11 +740,11 @@ public function testShouldSetRouterProcessorIfProcessorPropertyEmptyOnSendToProc ); $message = new Message(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); $driver->sendToProcessor($message); - $this->assertSame('router', $message->getProperty(Config::PARAMETER_PROCESSOR_NAME)); + $this->assertSame('router', $message->getProperty(Config::PROCESSOR_PARAMETER)); } public function testShouldSendCommandMessageToProcessorToDefaultQueue() @@ -785,8 +785,8 @@ public function testShouldSendCommandMessageToProcessorToDefaultQueue() ); $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'command'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::COMMAND_PARAMETER, 'command'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $driver->sendToProcessor($message); } @@ -829,8 +829,8 @@ public function testShouldSendCommandMessageToProcessorToCustomQueue() ); $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'command'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::COMMAND_PARAMETER, 'command'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $driver->sendToProcessor($message); } @@ -854,8 +854,8 @@ public function testThrowIfNoRouteFoundForCommandMessageOnSendToProcessor() ); $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'command'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::COMMAND_PARAMETER, 'command'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $this->expectException(\LogicException::class); $this->expectExceptionMessage('There is no route for command "command".'); @@ -900,12 +900,12 @@ public function testShouldOverwriteProcessorPropertySetByOneFromCommandRouteOnSe ); $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'command'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processorShouldBeOverwritten'); + $message->setProperty(Config::COMMAND_PARAMETER, 'command'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processorShouldBeOverwritten'); $driver->sendToProcessor($message); - $this->assertSame('expectedProcessor', $message->getProperty(Config::PARAMETER_PROCESSOR_NAME)); + $this->assertSame('expectedProcessor', $message->getProperty(Config::PROCESSOR_PARAMETER)); } public function testShouldNotInitDeliveryDelayOnSendMessageToProcessorIfPropertyNull() @@ -948,7 +948,7 @@ public function testShouldNotInitDeliveryDelayOnSendMessageToProcessorIfProperty ); $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'command'); + $message->setProperty(Config::COMMAND_PARAMETER, 'command'); $message->setDelay(null); $driver->sendToProcessor($message); @@ -994,7 +994,7 @@ public function testShouldNotInitPriorityOnSendMessageToProcessorIfPropertyNull( ); $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'command'); + $message->setProperty(Config::COMMAND_PARAMETER, 'command'); $message->setPriority(null); $driver->sendToProcessor($message); @@ -1040,7 +1040,7 @@ public function testShouldNotInitTimeToLiveOnSendMessageToProcessorIfPropertyNul ); $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'command'); + $message->setProperty(Config::COMMAND_PARAMETER, 'command'); $message->setExpire(null); $driver->sendToProcessor($message); @@ -1058,7 +1058,7 @@ public function testThrowIfNeitherTopicNorCommandAreSentOnSendToProcessor() $this->expectExceptionMessage('Queue name parameter is required but is not set'); $message = new Message(); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $this->expectException(\LogicException::class); $this->expectExceptionMessage('Either topic or command parameter must be set.'); diff --git a/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php b/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php index 9011f64fb..eda97f472 100644 --- a/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php @@ -250,8 +250,8 @@ public function shouldSendMessageToDelayExchangeIfDelaySet() ); $message = new Message(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topic'); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'processor'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); $message->setDelay(10); $driver->sendToProcessor($message); diff --git a/pkg/enqueue/Tests/Client/DriverPreSendTest.php b/pkg/enqueue/Tests/Client/DriverPreSendTest.php index aa9ff397f..95ac891ac 100644 --- a/pkg/enqueue/Tests/Client/DriverPreSendTest.php +++ b/pkg/enqueue/Tests/Client/DriverPreSendTest.php @@ -48,7 +48,7 @@ public function testShouldAllowGetArgumentSetInConstructor() public function testShouldAllowGetCommand() { $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'theCommand'); + $message->setProperty(Config::COMMAND_PARAMETER, 'theCommand'); $context = new DriverPreSend( $message, @@ -63,7 +63,7 @@ public function testShouldAllowGetCommand() public function testShouldAllowGetTopic() { $message = new Message(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'theTopic'); + $message->setProperty(Config::TOPIC_PARAMETER, 'theTopic'); $context = new DriverPreSend( $message, diff --git a/pkg/enqueue/Tests/Client/PostSendTest.php b/pkg/enqueue/Tests/Client/PostSendTest.php index 902403446..a68c12bdc 100644 --- a/pkg/enqueue/Tests/Client/PostSendTest.php +++ b/pkg/enqueue/Tests/Client/PostSendTest.php @@ -48,7 +48,7 @@ public function testShouldAllowGetArgumentSetInConstructor() public function testShouldAllowGetCommand() { $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'theCommand'); + $message->setProperty(Config::COMMAND_PARAMETER, 'theCommand'); $context = new PostSend( $message, @@ -63,7 +63,7 @@ public function testShouldAllowGetCommand() public function testShouldAllowGetTopic() { $message = new Message(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'theTopic'); + $message->setProperty(Config::TOPIC_PARAMETER, 'theTopic'); $context = new PostSend( $message, diff --git a/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php b/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php index 21b1f5b27..ea1855036 100644 --- a/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php +++ b/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php @@ -40,7 +40,7 @@ public function testShouldSendCommandToProcessor() $producer->sendCommand('command', $message); $expectedProperties = [ - 'enqueue.command_name' => 'command', + 'enqueue.command' => 'command', ]; self::assertEquals($expectedProperties, $message->getProperties()); @@ -136,7 +136,7 @@ public function testShouldSendCommandWithReplyAndCustomReplyQueueAndCorrelationI public function testShouldOverwriteExpectedMessageProperties() { $message = new Message(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'commandShouldBeOverwritten'); + $message->setProperty(Config::COMMAND_PARAMETER, 'commandShouldBeOverwritten'); $message->setScope('scopeShouldBeOverwritten'); $driver = $this->createDriverStub(); @@ -145,7 +145,7 @@ public function testShouldOverwriteExpectedMessageProperties() $producer->sendCommand('expectedCommand', $message); $expectedProperties = [ - 'enqueue.command_name' => 'expectedCommand', + 'enqueue.command' => 'expectedCommand', ]; self::assertEquals($expectedProperties, $message->getProperties()); @@ -299,8 +299,8 @@ public function testShouldSendCommandToApplicationRouter() ->method('sendToProcessor') ->willReturnCallback(function (Message $message) { self::assertSame('aBody', $message->getBody()); - self::assertNull($message->getProperty(Config::PARAMETER_PROCESSOR_NAME)); - self::assertSame('command', $message->getProperty(Config::PARAMETER_COMMAND_NAME)); + self::assertNull($message->getProperty(Config::PROCESSOR_PARAMETER)); + self::assertSame('command', $message->getProperty(Config::COMMAND_PARAMETER)); }) ; @@ -313,7 +313,7 @@ public function testThrowWhenProcessorNamePropertySetToApplicationRouter() $message = new Message(); $message->setBody('aBody'); $message->setScope(Message::SCOPE_APP); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'aCustomProcessor'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'aCustomProcessor'); $driver = $this->createDriverStub(); $driver @@ -324,7 +324,7 @@ public function testThrowWhenProcessorNamePropertySetToApplicationRouter() $producer = new Producer($driver, $this->createRpcFactoryMock()); $this->expectException(\LogicException::class); - $this->expectExceptionMessage('The enqueue.processor_name property must not be set.'); + $this->expectExceptionMessage('The enqueue.processor property must not be set.'); $producer->sendCommand('command', $message); } diff --git a/pkg/enqueue/Tests/Client/ProducerSendEventTest.php b/pkg/enqueue/Tests/Client/ProducerSendEventTest.php index 757c61234..e957e16c5 100644 --- a/pkg/enqueue/Tests/Client/ProducerSendEventTest.php +++ b/pkg/enqueue/Tests/Client/ProducerSendEventTest.php @@ -36,7 +36,7 @@ public function testShouldSendEventToRouter() $producer->sendEvent('topic', $message); $expectedProperties = [ - 'enqueue.topic_name' => 'topic', + 'enqueue.topic' => 'topic', ]; self::assertEquals($expectedProperties, $message->getProperties()); @@ -45,7 +45,7 @@ public function testShouldSendEventToRouter() public function testShouldOverwriteTopicProperty() { $message = new Message(); - $message->setProperty(Config::PARAMETER_TOPIC_NAME, 'topicShouldBeOverwritten'); + $message->setProperty(Config::TOPIC_PARAMETER, 'topicShouldBeOverwritten'); $driver = $this->createDriverStub(); @@ -53,7 +53,7 @@ public function testShouldOverwriteTopicProperty() $producer->sendEvent('expectedTopic', $message); $expectedProperties = [ - 'enqueue.topic_name' => 'expectedTopic', + 'enqueue.topic' => 'expectedTopic', ]; self::assertEquals($expectedProperties, $message->getProperties()); @@ -198,7 +198,7 @@ public function testThrowIfSendEventToMessageBusWithProcessorNamePropertySet() { $message = new Message(); $message->setBody(''); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'aProcessor'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'aProcessor'); $driver = $this->createDriverStub(); $driver @@ -213,7 +213,7 @@ public function testThrowIfSendEventToMessageBusWithProcessorNamePropertySet() $producer = new Producer($driver, $this->createRpcFactoryMock()); $this->expectException(\LogicException::class); - $this->expectExceptionMessage('The enqueue.processor_name property must not be set.'); + $this->expectExceptionMessage('The enqueue.processor property must not be set.'); $producer->sendEvent('topic', $message); } @@ -235,7 +235,7 @@ public function testShouldSendEventToApplicationRouter() self::assertSame('aBody', $message->getBody()); // null means a driver sends a message to router processor. - self::assertNull($message->getProperty(Config::PARAMETER_PROCESSOR_NAME)); + self::assertNull($message->getProperty(Config::PROCESSOR_PARAMETER)); }) ; @@ -248,7 +248,7 @@ public function testThrowWhenProcessorNamePropertySetToApplicationRouter() $message = new Message(); $message->setBody('aBody'); $message->setScope(Message::SCOPE_APP); - $message->setProperty(Config::PARAMETER_PROCESSOR_NAME, 'aCustomProcessor'); + $message->setProperty(Config::PROCESSOR_PARAMETER, 'aCustomProcessor'); $driver = $this->createDriverStub(); $driver @@ -259,7 +259,7 @@ public function testThrowWhenProcessorNamePropertySetToApplicationRouter() $producer = new Producer($driver, $this->createRpcFactoryMock()); $this->expectException(\LogicException::class); - $this->expectExceptionMessage('The enqueue.processor_name property must not be set.'); + $this->expectExceptionMessage('The enqueue.processor property must not be set.'); $producer->sendEvent('topic', $message); } diff --git a/pkg/enqueue/Tests/Client/RouterProcessorTest.php b/pkg/enqueue/Tests/Client/RouterProcessorTest.php index f38d4481d..0c245d446 100644 --- a/pkg/enqueue/Tests/Client/RouterProcessorTest.php +++ b/pkg/enqueue/Tests/Client/RouterProcessorTest.php @@ -45,7 +45,7 @@ public function testShouldRejectIfTopicNotSet() $result = $router->process(new NullMessage(), new NullContext()); $this->assertEquals(Result::REJECT, $result->getStatus()); - $this->assertEquals('Topic property "enqueue.topic_name" is required but not set or empty.', $result->getReason()); + $this->assertEquals('Topic property "enqueue.topic" is required but not set or empty.', $result->getReason()); } public function testShouldRejectIfCommandSet() @@ -53,7 +53,7 @@ public function testShouldRejectIfCommandSet() $router = new RouterProcessor($this->createDriverStub()); $message = new NullMessage(); - $message->setProperty(Config::PARAMETER_COMMAND_NAME, 'aCommand'); + $message->setProperty(Config::COMMAND_PARAMETER, 'aCommand'); $result = $router->process($message, new NullContext()); @@ -66,7 +66,7 @@ public function testShouldRouteOriginalMessageToAllRecipients() $message = new NullMessage(); $message->setBody('theBody'); $message->setHeaders(['aHeader' => 'aHeaderVal']); - $message->setProperties(['aProp' => 'aPropVal', Config::PARAMETER_TOPIC_NAME => 'theTopicName']); + $message->setProperties(['aProp' => 'aPropVal', Config::TOPIC_PARAMETER => 'theTopicName']); /** @var Message[] $routedMessages */ $routedMessages = new \ArrayObject(); @@ -103,16 +103,9 @@ public function testShouldRouteOriginalMessageToAllRecipients() $this->assertContainsOnly(Message::class, $routedMessages); $this->assertCount(3, $routedMessages); - $this->assertSame('aFooProcessor', $routedMessages[0]->getProperty(Config::PARAMETER_PROCESSOR_NAME)); - $this->assertSame('aBarProcessor', $routedMessages[1]->getProperty(Config::PARAMETER_PROCESSOR_NAME)); - $this->assertSame('aBazProcessor', $routedMessages[2]->getProperty(Config::PARAMETER_PROCESSOR_NAME)); - -// $this->assertEquals([ -// 'aProp' => 'aPropVal', -// 'enqueue.topic_name' => 'theTopicName', -// 'enqueue.processor_name' => 'aFooProcessor', -// 'enqueue.processor_queue_name' => 'aQueueName', -// ], $routedMessages[0]->getProperties()); + $this->assertSame('aFooProcessor', $routedMessages[0]->getProperty(Config::PROCESSOR_PARAMETER)); + $this->assertSame('aBarProcessor', $routedMessages[1]->getProperty(Config::PROCESSOR_PARAMETER)); + $this->assertSame('aBazProcessor', $routedMessages[2]->getProperty(Config::PROCESSOR_PARAMETER)); } public function testShouldDoNothingIfNoRoutes() @@ -120,7 +113,7 @@ public function testShouldDoNothingIfNoRoutes() $message = new NullMessage(); $message->setBody('theBody'); $message->setHeaders(['aHeader' => 'aHeaderVal']); - $message->setProperties(['aProp' => 'aPropVal', Config::PARAMETER_TOPIC_NAME => 'theTopicName']); + $message->setProperties(['aProp' => 'aPropVal', Config::TOPIC_PARAMETER => 'theTopicName']); /** @var Message[] $routedMessages */ $routedMessages = new \ArrayObject(); @@ -158,7 +151,7 @@ public function testShouldDoNotModifyOriginalMessage() $message = new NullMessage(); $message->setBody('theBody'); $message->setHeaders(['aHeader' => 'aHeaderVal']); - $message->setProperties(['aProp' => 'aPropVal', Config::PARAMETER_TOPIC_NAME => 'theTopicName']); + $message->setProperties(['aProp' => 'aPropVal', Config::TOPIC_PARAMETER => 'theTopicName']); /** @var Message[] $routedMessages */ $routedMessages = new \ArrayObject(); @@ -190,7 +183,7 @@ public function testShouldDoNotModifyOriginalMessage() $this->assertEquals(Result::ACK, $result->getStatus()); $this->assertSame('theBody', $message->getBody()); - $this->assertSame(['aProp' => 'aPropVal', Config::PARAMETER_TOPIC_NAME => 'theTopicName'], $message->getProperties()); + $this->assertSame(['aProp' => 'aPropVal', Config::TOPIC_PARAMETER => 'theTopicName'], $message->getProperties()); $this->assertSame(['aHeader' => 'aHeaderVal'], $message->getHeaders()); } diff --git a/pkg/fs/Tests/Functional/FsConsumerTest.php b/pkg/fs/Tests/Functional/FsConsumerTest.php index 50cab8533..782053e0a 100644 --- a/pkg/fs/Tests/Functional/FsConsumerTest.php +++ b/pkg/fs/Tests/Functional/FsConsumerTest.php @@ -137,7 +137,7 @@ public function testShouldThrowExceptionForTheCorruptedQueueFile() $context->purgeQueue($queue); $context->workWithFile($queue, 'a+', function (FsDestination $destination, $file) { - fwrite($file, '|{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_red_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic_name":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"46fdc345-5d0c-426e-95ac-227c7e657839","timestamp":1505379216,"reply_to":null,"correlation_id":""}} |{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_black_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic_name":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"c4d60e39-3a8c-42df-b536-c8b7c13e006d","timestamp":1505379216,"reply_to":null,"correlation_id":""}} |{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_green_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic_name":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"3a6aa176-c879-4435-9626-c48e0643defa","timestamp":1505379216,"reply_to":null,"correlation_id":""}}'); + fwrite($file, '|{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_red_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"46fdc345-5d0c-426e-95ac-227c7e657839","timestamp":1505379216,"reply_to":null,"correlation_id":""}} |{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_black_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"c4d60e39-3a8c-42df-b536-c8b7c13e006d","timestamp":1505379216,"reply_to":null,"correlation_id":""}} |{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_green_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"3a6aa176-c879-4435-9626-c48e0643defa","timestamp":1505379216,"reply_to":null,"correlation_id":""}}'); }); $consumer = $context->createConsumer($queue); @@ -182,13 +182,13 @@ public function testShouldUnEscapeDelimiterSymbolsInMessageBody() $queue = $context->createQueue('fs_test_queue'); $context->purgeQueue($queue); - $message = $this->fsContext->createMessage(' |{"body":"aMessageData","properties":{"enqueue.topic_name":"user_updated"},"headers":{"content_type":"text\/plain","message_id":"90979b6c-d9ff-4b39-9938-878b83a95360","timestamp":1519899428,"reply_to":null,"correlation_id":""}}'); + $message = $this->fsContext->createMessage(' |{"body":"aMessageData","properties":{"enqueue.topic":"user_updated"},"headers":{"content_type":"text\/plain","message_id":"90979b6c-d9ff-4b39-9938-878b83a95360","timestamp":1519899428,"reply_to":null,"correlation_id":""}}'); $this->fsContext->createProducer()->send($queue, $message); $this->assertSame(0, strlen(file_get_contents(sys_get_temp_dir().'/fs_test_queue')) % 64); $this->assertSame( - ' |{"body":" \|\{\"body\":\"aMessageData\",\"properties\":{\"enqueue.topic_name\":\"user_updated\"},\"headers\":{\"content_type\":\"text\\\\\/plain\",\"message_id\":\"90979b6c-d9ff-4b39-9938-878b83a95360\",\"timestamp\":1519899428,\"reply_to\":null,\"correlation_id\":\"\"}}","properties":[],"headers":[]}', + ' |{"body":" \|\{\"body\":\"aMessageData\",\"properties\":{\"enqueue.topic\":\"user_updated\"},\"headers\":{\"content_type\":\"text\\\\\/plain\",\"message_id\":\"90979b6c-d9ff-4b39-9938-878b83a95360\",\"timestamp\":1519899428,\"reply_to\":null,\"correlation_id\":\"\"}}","properties":[],"headers":[]}', file_get_contents(sys_get_temp_dir().'/fs_test_queue') ); @@ -196,6 +196,6 @@ public function testShouldUnEscapeDelimiterSymbolsInMessageBody() $message = $consumer->receiveNoWait(); - $this->assertSame(' |{"body":"aMessageData","properties":{"enqueue.topic_name":"user_updated"},"headers":{"content_type":"text\/plain","message_id":"90979b6c-d9ff-4b39-9938-878b83a95360","timestamp":1519899428,"reply_to":null,"correlation_id":""}}', $message->getBody()); + $this->assertSame(' |{"body":"aMessageData","properties":{"enqueue.topic":"user_updated"},"headers":{"content_type":"text\/plain","message_id":"90979b6c-d9ff-4b39-9938-878b83a95360","timestamp":1519899428,"reply_to":null,"correlation_id":""}}', $message->getBody()); } } diff --git a/pkg/simple-client/SimpleClient.php b/pkg/simple-client/SimpleClient.php index a74836420..7a4cff3ca 100644 --- a/pkg/simple-client/SimpleClient.php +++ b/pkg/simple-client/SimpleClient.php @@ -297,9 +297,9 @@ private function createConfiguration(): NodeInterface ->children() ->scalarNode('prefix')->defaultValue('enqueue')->end() ->scalarNode('app_name')->defaultValue('app')->end() - ->scalarNode('router_topic')->defaultValue(Config::DEFAULT_PROCESSOR_QUEUE_NAME)->cannotBeEmpty()->end() - ->scalarNode('router_queue')->defaultValue(Config::DEFAULT_PROCESSOR_QUEUE_NAME)->cannotBeEmpty()->end() - ->scalarNode('default_processor_queue')->defaultValue(Config::DEFAULT_PROCESSOR_QUEUE_NAME)->cannotBeEmpty()->end() + ->scalarNode('router_topic')->defaultValue('default')->cannotBeEmpty()->end() + ->scalarNode('router_queue')->defaultValue('default')->cannotBeEmpty()->end() + ->scalarNode('default_processor_queue')->defaultValue('default')->cannotBeEmpty()->end() ->integerNode('redelivered_delay_time')->min(0)->defaultValue(0)->end() ->end() ->end() From cafc0e45fec81cf4bb5cc40d882e79a457d1be56 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Fri, 28 Sep 2018 21:05:19 +0300 Subject: [PATCH 2/4] [client] Reorganize configuration. Remove unused parameters. --- pkg/enqueue/Client/Driver/GenericDriver.php | 6 +++--- pkg/enqueue/Client/Driver/RabbitMqStompDriver.php | 2 +- pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php | 2 +- pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php | 2 +- pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php | 6 +++--- pkg/enqueue/Tests/Client/Driver/RabbitMqDriverTest.php | 2 +- pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php | 2 +- pkg/enqueue/Tests/Client/Driver/StompDriverTest.php | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/enqueue/Client/Driver/GenericDriver.php b/pkg/enqueue/Client/Driver/GenericDriver.php index 627e63e7d..9a8e47f92 100644 --- a/pkg/enqueue/Client/Driver/GenericDriver.php +++ b/pkg/enqueue/Client/Driver/GenericDriver.php @@ -96,7 +96,7 @@ public function sendToProcessor(Message $message): void $producer = $this->context->createProducer(); - if (null !== $delay = $transportMessage->getProperty('X-Enqueue-Delay')) { + if (null !== $delay = $transportMessage->getProperty(Config::DELAY_PARAMETER)) { $producer->setDeliveryDelay($delay * 1000); } @@ -161,7 +161,7 @@ public function createTransportMessage(Message $clientMessage): InteropMessage } if ($delay = $clientMessage->getDelay()) { - $transportMessage->setProperty('X-Enqueue-Delay', $delay); + $transportMessage->setProperty(Config::DELAY_PARAMETER, $delay); } return $transportMessage; @@ -187,7 +187,7 @@ public function createClientMessage(InteropMessage $transportMessage): Message $clientMessage->setPriority($priority); } - if ($delay = $transportMessage->getProperty('X-Enqueue-Delay')) { + if ($delay = $transportMessage->getProperty(Config::DELAY_PARAMETER)) { $clientMessage->setDelay((int) $delay); } diff --git a/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php b/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php index 77b4293c0..dcf0a47e7 100644 --- a/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php +++ b/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php @@ -169,7 +169,7 @@ protected function doSendToRouter(InteropProducer $producer, Destination $topic, */ protected function doSendToProcessor(InteropProducer $producer, InteropQueue $destination, InteropMessage $transportMessage): void { - if ($delay = $transportMessage->getProperty('X-Enqueue-Delay')) { + if ($delay = $transportMessage->getProperty(Config::DELAY_PARAMETER)) { $producer->setDeliveryDelay(null); $destination = $this->createDelayedTopic($destination); } diff --git a/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php b/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php index e7d76e287..d5d4c257f 100644 --- a/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php @@ -352,7 +352,7 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi 'X-Enqueue-Content-Type' => 'ContentType', 'X-Enqueue-Priority' => MessagePriority::HIGH, 'X-Enqueue-Expire' => 123, - 'X-Enqueue-Delay' => 345, + 'enqueue.delay' => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); diff --git a/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php b/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php index 733e9ac20..f145859a7 100644 --- a/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php @@ -71,7 +71,7 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi 'X-Enqueue-Content-Type' => 'ContentType', 'X-Enqueue-Priority' => MessagePriority::HIGH, 'X-Enqueue-Expire' => 123, - 'X-Enqueue-Delay' => 345, + 'enqueue.delay' => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); diff --git a/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php b/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php index 782add3be..cf8a5f5d7 100644 --- a/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php +++ b/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php @@ -200,7 +200,7 @@ public function testShouldCreateClientMessageFromTransportOne() $transportMessage->setProperty('X-Enqueue-Content-Type', 'theContentType'); $transportMessage->setProperty('X-Enqueue-Expire', '22'); $transportMessage->setProperty('X-Enqueue-Priority', MessagePriority::HIGH); - $transportMessage->setProperty('X-Enqueue-Delay', '44'); + $transportMessage->setProperty('enqueue.delay', '44'); $transportMessage->setMessageId('theMessageId'); $transportMessage->setTimestamp(1000); $transportMessage->setReplyTo('theReplyTo'); @@ -1124,7 +1124,7 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi 'X-Enqueue-Content-Type' => 'ContentType', 'X-Enqueue-Priority' => MessagePriority::HIGH, 'X-Enqueue-Expire' => 123, - 'X-Enqueue-Delay' => 345, + 'enqueue.delay' => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); @@ -1143,7 +1143,7 @@ protected function assertClientMessage(Message $clientMessage): void 'X-Enqueue-Content-Type' => 'theContentType', 'X-Enqueue-Expire' => '22', 'X-Enqueue-Priority' => MessagePriority::HIGH, - 'X-Enqueue-Delay' => '44', + 'enqueue.delay' => '44', ], $clientMessage->getProperties()); $this->assertSame('theMessageId', $clientMessage->getMessageId()); $this->assertSame(22, $clientMessage->getExpire()); diff --git a/pkg/enqueue/Tests/Client/Driver/RabbitMqDriverTest.php b/pkg/enqueue/Tests/Client/Driver/RabbitMqDriverTest.php index d6604ed73..eebb9b787 100644 --- a/pkg/enqueue/Tests/Client/Driver/RabbitMqDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/RabbitMqDriverTest.php @@ -130,7 +130,7 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi 'X-Enqueue-Content-Type' => 'ContentType', 'X-Enqueue-Priority' => MessagePriority::HIGH, 'X-Enqueue-Expire' => 123, - 'X-Enqueue-Delay' => 345, + 'enqueue.delay' => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); diff --git a/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php b/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php index eda97f472..22cda4e72 100644 --- a/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php @@ -543,7 +543,7 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi 'X-Enqueue-Content-Type' => 'ContentType', 'X-Enqueue-Priority' => MessagePriority::HIGH, 'X-Enqueue-Expire' => 123, - 'X-Enqueue-Delay' => 345, + 'enqueue.delay' => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); diff --git a/pkg/enqueue/Tests/Client/Driver/StompDriverTest.php b/pkg/enqueue/Tests/Client/Driver/StompDriverTest.php index 26199d346..0a3415c57 100644 --- a/pkg/enqueue/Tests/Client/Driver/StompDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/StompDriverTest.php @@ -169,7 +169,7 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi 'X-Enqueue-Content-Type' => 'ContentType', 'X-Enqueue-Priority' => MessagePriority::HIGH, 'X-Enqueue-Expire' => 123, - 'X-Enqueue-Delay' => 345, + 'enqueue.delay' => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); From 3ddf354f09b99edf972e0c8a4a6b58e8ad158e18 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Mon, 1 Oct 2018 17:08:35 +0300 Subject: [PATCH 3/4] Merge master --- pkg/enqueue/Client/Config.php | 13 +-- .../ExclusiveCommandExtension.php | 10 +-- .../SetRouterPropertiesExtension.php | 4 +- pkg/enqueue/Client/DelegateProcessor.php | 4 +- pkg/enqueue/Client/Driver/GenericDriver.php | 40 ++++----- .../Client/Driver/RabbitMqStompDriver.php | 2 +- pkg/enqueue/Client/DriverPreSend.php | 8 +- pkg/enqueue/Client/PostSend.php | 8 +- pkg/enqueue/Client/Producer.php | 8 +- pkg/enqueue/Client/RouterProcessor.php | 10 +-- .../ExclusiveCommandExtensionTest.php | 6 +- .../SetRouterPropertiesExtensionTest.php | 2 +- .../Tests/Client/DelegateProcessorTest.php | 2 +- .../Tests/Client/Driver/AmqpDriverTest.php | 10 +-- .../Tests/Client/Driver/GenericDriverTest.php | 9 +- .../Client/Driver/GenericDriverTestsTrait.php | 86 +++++++++---------- .../Client/Driver/RabbitMqDriverTest.php | 9 +- .../Client/Driver/RabbitMqStompDriverTest.php | 12 +-- .../Tests/Client/Driver/StompDriverTest.php | 9 +- .../Tests/Client/DriverPreSendTest.php | 4 +- pkg/enqueue/Tests/Client/PostSendTest.php | 4 +- .../Tests/Client/ProducerSendCommandTest.php | 8 +- .../Tests/Client/ProducerSendEventTest.php | 8 +- .../Tests/Client/RouterProcessorTest.php | 16 ++-- pkg/fs/Tests/Functional/FsConsumerTest.php | 8 +- 25 files changed, 152 insertions(+), 148 deletions(-) diff --git a/pkg/enqueue/Client/Config.php b/pkg/enqueue/Client/Config.php index 07bd3e0ea..0dc4ee5f8 100644 --- a/pkg/enqueue/Client/Config.php +++ b/pkg/enqueue/Client/Config.php @@ -4,12 +4,13 @@ class Config { - const TOPIC_PARAMETER = 'enqueue.topic'; - const COMMAND_PARAMETER = 'enqueue.command'; - const PROCESSOR_PARAMETER = 'enqueue.processor'; - const EXPIRE_PARAMETER = 'enqueue.expire'; - const PRIORITY_PARAMETER = 'enqueue.priority'; - const DELAY_PARAMETER = 'enqueue.delay'; + const TOPIC = 'enqueue.topic'; + const COMMAND = 'enqueue.command'; + const PROCESSOR = 'enqueue.processor'; + const EXPIRE = 'enqueue.expire'; + const PRIORITY = 'enqueue.priority'; + const DELAY = 'enqueue.delay'; + const CONTENT_TYPE = 'enqueue.content_type'; /** * @var string diff --git a/pkg/enqueue/Client/ConsumptionExtension/ExclusiveCommandExtension.php b/pkg/enqueue/Client/ConsumptionExtension/ExclusiveCommandExtension.php index 2ebd8a6db..e9bbbd8e2 100644 --- a/pkg/enqueue/Client/ConsumptionExtension/ExclusiveCommandExtension.php +++ b/pkg/enqueue/Client/ConsumptionExtension/ExclusiveCommandExtension.php @@ -33,13 +33,13 @@ public function onPreReceived(Context $context) $message = $context->getInteropMessage(); $queue = $context->getInteropQueue(); - if ($message->getProperty(Config::TOPIC_PARAMETER)) { + if ($message->getProperty(Config::TOPIC)) { return; } - if ($message->getProperty(Config::COMMAND_PARAMETER)) { + if ($message->getProperty(Config::COMMAND)) { return; } - if ($message->getProperty(Config::PROCESSOR_PARAMETER)) { + if ($message->getProperty(Config::PROCESSOR)) { return; } @@ -51,8 +51,8 @@ public function onPreReceived(Context $context) $context->getLogger()->debug('[ExclusiveCommandExtension] This is a exclusive command queue and client\'s properties are not set. Setting them'); $route = $this->queueToRouteMap[$queue->getQueueName()]; - $message->setProperty(Config::PROCESSOR_PARAMETER, $route->getProcessor()); - $message->setProperty(Config::COMMAND_PARAMETER, $route->getSource()); + $message->setProperty(Config::PROCESSOR, $route->getProcessor()); + $message->setProperty(Config::COMMAND, $route->getSource()); } } diff --git a/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php b/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php index d5c3cee41..2ecc1dded 100644 --- a/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php +++ b/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php @@ -28,7 +28,7 @@ public function __construct(DriverInterface $driver) public function onPreReceived(Context $context) { $message = $context->getInteropMessage(); - if ($message->getProperty(Config::PROCESSOR_PARAMETER)) { + if ($message->getProperty(Config::PROCESSOR)) { return; } @@ -39,7 +39,7 @@ public function onPreReceived(Context $context) } // RouterProcessor is our default message processor when that header is not set - $message->setProperty(Config::PROCESSOR_PARAMETER, $config->getRouterProcessorName()); + $message->setProperty(Config::PROCESSOR, $config->getRouterProcessorName()); $context->getLogger()->debug( '[SetRouterPropertiesExtension] '. diff --git a/pkg/enqueue/Client/DelegateProcessor.php b/pkg/enqueue/Client/DelegateProcessor.php index 920c4afd0..705ff1266 100644 --- a/pkg/enqueue/Client/DelegateProcessor.php +++ b/pkg/enqueue/Client/DelegateProcessor.php @@ -26,11 +26,11 @@ public function __construct(ProcessorRegistryInterface $registry) */ public function process(InteropMessage $message, Context $context) { - $processorName = $message->getProperty(Config::PROCESSOR_PARAMETER); + $processorName = $message->getProperty(Config::PROCESSOR); if (false == $processorName) { throw new \LogicException(sprintf( 'Got message without required parameter: "%s"', - Config::PROCESSOR_PARAMETER + Config::PROCESSOR )); } diff --git a/pkg/enqueue/Client/Driver/GenericDriver.php b/pkg/enqueue/Client/Driver/GenericDriver.php index 9a8e47f92..2da6b7dcb 100644 --- a/pkg/enqueue/Client/Driver/GenericDriver.php +++ b/pkg/enqueue/Client/Driver/GenericDriver.php @@ -47,10 +47,10 @@ public function __construct( public function sendToRouter(Message $message): void { - if ($message->getProperty(Config::COMMAND_PARAMETER)) { + if ($message->getProperty(Config::COMMAND)) { throw new \LogicException('Command must not be send to router but go directly to its processor.'); } - if (false == $message->getProperty(Config::TOPIC_PARAMETER)) { + if (false == $message->getProperty(Config::TOPIC)) { throw new \LogicException('Topic name parameter is required but is not set'); } @@ -63,21 +63,21 @@ public function sendToRouter(Message $message): void public function sendToProcessor(Message $message): void { - $topic = $message->getProperty(Config::TOPIC_PARAMETER); - $command = $message->getProperty(Config::COMMAND_PARAMETER); + $topic = $message->getProperty(Config::TOPIC); + $command = $message->getProperty(Config::COMMAND); /** @var InteropQueue $queue */ $queue = null; - if ($topic && $processor = $message->getProperty(Config::PROCESSOR_PARAMETER)) { + if ($topic && $processor = $message->getProperty(Config::PROCESSOR)) { $route = $this->routeCollection->topicAndProcessor($topic, $processor); if (false == $route) { throw new \LogicException(sprintf('There is no route for topic "%s" and processor "%s"', $topic, $processor)); } - $message->setProperty(Config::PROCESSOR_PARAMETER, $route->getProcessor()); + $message->setProperty(Config::PROCESSOR, $route->getProcessor()); $queue = $this->createRouteQueue($route); - } elseif ($topic && false == $message->getProperty(Config::PROCESSOR_PARAMETER)) { - $message->setProperty(Config::PROCESSOR_PARAMETER, $this->config->getRouterProcessorName()); + } elseif ($topic && false == $message->getProperty(Config::PROCESSOR)) { + $message->setProperty(Config::PROCESSOR, $this->config->getRouterProcessorName()); $queue = $this->createQueue($this->config->getRouterQueueName()); } elseif ($command) { @@ -86,7 +86,7 @@ public function sendToProcessor(Message $message): void throw new \LogicException(sprintf('There is no route for command "%s".', $command)); } - $message->setProperty(Config::PROCESSOR_PARAMETER, $route->getProcessor()); + $message->setProperty(Config::PROCESSOR, $route->getProcessor()); $queue = $this->createRouteQueue($route); } else { throw new \LogicException('Either topic or command parameter must be set.'); @@ -96,15 +96,15 @@ public function sendToProcessor(Message $message): void $producer = $this->context->createProducer(); - if (null !== $delay = $transportMessage->getProperty(Config::DELAY_PARAMETER)) { + if (null !== $delay = $transportMessage->getProperty(Config::DELAY)) { $producer->setDeliveryDelay($delay * 1000); } - if (null !== $expire = $transportMessage->getProperty('X-Enqueue-Expire')) { + if (null !== $expire = $transportMessage->getProperty(Config::EXPIRE)) { $producer->setTimeToLive($expire * 1000); } - if (null !== $priority = $transportMessage->getProperty('X-Enqueue-Priority')) { + if (null !== $priority = $transportMessage->getProperty(Config::PRIORITY)) { $priorityMap = $this->getPriorityMap(); $producer->setPriority($priorityMap[$priority]); @@ -149,19 +149,19 @@ public function createTransportMessage(Message $clientMessage): InteropMessage $transportMessage->setCorrelationId($clientMessage->getCorrelationId()); if ($contentType = $clientMessage->getContentType()) { - $transportMessage->setProperty('X-Enqueue-Content-Type', $contentType); + $transportMessage->setProperty(Config::CONTENT_TYPE, $contentType); } if ($priority = $clientMessage->getPriority()) { - $transportMessage->setProperty('X-Enqueue-Priority', $priority); + $transportMessage->setProperty(Config::PRIORITY, $priority); } if ($expire = $clientMessage->getExpire()) { - $transportMessage->setProperty('X-Enqueue-Expire', $expire); + $transportMessage->setProperty(Config::EXPIRE, $expire); } if ($delay = $clientMessage->getDelay()) { - $transportMessage->setProperty(Config::DELAY_PARAMETER, $delay); + $transportMessage->setProperty(Config::DELAY, $delay); } return $transportMessage; @@ -179,19 +179,19 @@ public function createClientMessage(InteropMessage $transportMessage): Message $clientMessage->setReplyTo($transportMessage->getReplyTo()); $clientMessage->setCorrelationId($transportMessage->getCorrelationId()); - if ($contentType = $transportMessage->getProperty('X-Enqueue-Content-Type')) { + if ($contentType = $transportMessage->getProperty(Config::CONTENT_TYPE)) { $clientMessage->setContentType($contentType); } - if ($priority = $transportMessage->getProperty('X-Enqueue-Priority')) { + if ($priority = $transportMessage->getProperty(Config::PRIORITY)) { $clientMessage->setPriority($priority); } - if ($delay = $transportMessage->getProperty(Config::DELAY_PARAMETER)) { + if ($delay = $transportMessage->getProperty(Config::DELAY)) { $clientMessage->setDelay((int) $delay); } - if ($expire = $transportMessage->getProperty('X-Enqueue-Expire')) { + if ($expire = $transportMessage->getProperty(Config::EXPIRE)) { $clientMessage->setExpire((int) $expire); } diff --git a/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php b/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php index dcf0a47e7..c2ca768ab 100644 --- a/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php +++ b/pkg/enqueue/Client/Driver/RabbitMqStompDriver.php @@ -169,7 +169,7 @@ protected function doSendToRouter(InteropProducer $producer, Destination $topic, */ protected function doSendToProcessor(InteropProducer $producer, InteropQueue $destination, InteropMessage $transportMessage): void { - if ($delay = $transportMessage->getProperty(Config::DELAY_PARAMETER)) { + if ($delay = $transportMessage->getProperty(Config::DELAY)) { $producer->setDeliveryDelay(null); $destination = $this->createDelayedTopic($destination); } diff --git a/pkg/enqueue/Client/DriverPreSend.php b/pkg/enqueue/Client/DriverPreSend.php index 8a92fd964..cae615d14 100644 --- a/pkg/enqueue/Client/DriverPreSend.php +++ b/pkg/enqueue/Client/DriverPreSend.php @@ -34,21 +34,21 @@ public function getDriver(): DriverInterface public function isEvent(): bool { - return (bool) $this->message->getProperty(Config::TOPIC_PARAMETER); + return (bool) $this->message->getProperty(Config::TOPIC); } public function isCommand(): bool { - return (bool) $this->message->getProperty(Config::COMMAND_PARAMETER); + return (bool) $this->message->getProperty(Config::COMMAND); } public function getCommand(): string { - return $this->message->getProperty(Config::COMMAND_PARAMETER); + return $this->message->getProperty(Config::COMMAND); } public function getTopic(): string { - return $this->message->getProperty(Config::TOPIC_PARAMETER); + return $this->message->getProperty(Config::TOPIC); } } diff --git a/pkg/enqueue/Client/PostSend.php b/pkg/enqueue/Client/PostSend.php index 5cfafb397..1c5ab9d04 100644 --- a/pkg/enqueue/Client/PostSend.php +++ b/pkg/enqueue/Client/PostSend.php @@ -34,21 +34,21 @@ public function getDriver(): DriverInterface public function isEvent(): bool { - return (bool) $this->message->getProperty(Config::TOPIC_PARAMETER); + return (bool) $this->message->getProperty(Config::TOPIC); } public function isCommand(): bool { - return (bool) $this->message->getProperty(Config::COMMAND_PARAMETER); + return (bool) $this->message->getProperty(Config::COMMAND); } public function getCommand(): string { - return $this->message->getProperty(Config::COMMAND_PARAMETER); + return $this->message->getProperty(Config::COMMAND); } public function getTopic(): string { - return $this->message->getProperty(Config::TOPIC_PARAMETER); + return $this->message->getProperty(Config::TOPIC); } } diff --git a/pkg/enqueue/Client/Producer.php b/pkg/enqueue/Client/Producer.php index e6aae73a6..702ec381f 100644 --- a/pkg/enqueue/Client/Producer.php +++ b/pkg/enqueue/Client/Producer.php @@ -48,7 +48,7 @@ public function sendEvent(string $topic, $message): void $this->extension->onPreSendEvent($preSend); $message = $preSend->getMessage(); - $message->setProperty(Config::TOPIC_PARAMETER, $preSend->getTopic()); + $message->setProperty(Config::TOPIC, $preSend->getTopic()); $this->doSend($message); } @@ -79,7 +79,7 @@ public function sendCommand(string $command, $message, bool $needReply = false): } } - $message->setProperty(Config::COMMAND_PARAMETER, $command); + $message->setProperty(Config::COMMAND, $command); $message->setScope(Message::SCOPE_APP); $this->doSend($message); @@ -103,8 +103,8 @@ private function doSend(Message $message): void )); } - if ($message->getProperty(Config::PROCESSOR_PARAMETER)) { - throw new \LogicException(sprintf('The %s property must not be set.', Config::PROCESSOR_PARAMETER)); + if ($message->getProperty(Config::PROCESSOR)) { + throw new \LogicException(sprintf('The %s property must not be set.', Config::PROCESSOR)); } if (!$message->getMessageId()) { diff --git a/pkg/enqueue/Client/RouterProcessor.php b/pkg/enqueue/Client/RouterProcessor.php index 220d8ecf9..c4832fd0f 100644 --- a/pkg/enqueue/Client/RouterProcessor.php +++ b/pkg/enqueue/Client/RouterProcessor.php @@ -21,22 +21,22 @@ public function __construct(DriverInterface $driver) public function process(InteropMessage $message, Context $context): Result { - if ($message->getProperty(Config::COMMAND_PARAMETER)) { + if ($message->getProperty(Config::COMMAND)) { return Result::reject(sprintf( 'Unexpected command "%s" got. Command must not go to the router.', - $message->getProperty(Config::COMMAND_PARAMETER) + $message->getProperty(Config::COMMAND) )); } - $topic = $message->getProperty(Config::TOPIC_PARAMETER); + $topic = $message->getProperty(Config::TOPIC); if (false == $topic) { - return Result::reject(sprintf('Topic property "%s" is required but not set or empty.', Config::TOPIC_PARAMETER)); + return Result::reject(sprintf('Topic property "%s" is required but not set or empty.', Config::TOPIC)); } $count = 0; foreach ($this->driver->getRouteCollection()->topic($topic) as $route) { $clientMessage = $this->driver->createClientMessage($message); - $clientMessage->setProperty(Config::PROCESSOR_PARAMETER, $route->getProcessor()); + $clientMessage->setProperty(Config::PROCESSOR, $route->getProcessor()); $this->driver->sendToProcessor($clientMessage); diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php index 63433712f..8117645b8 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php @@ -38,7 +38,7 @@ public function testCouldBeConstructedWithDriverAsFirstArgument() public function testShouldDoNothingIfMessageHasTopicPropertySetOnPreReceive() { $message = new NullMessage(); - $message->setProperty(Config::TOPIC_PARAMETER, 'aTopic'); + $message->setProperty(Config::TOPIC, 'aTopic'); $context = new Context(new NullContext()); $context->setInteropMessage($message); @@ -63,7 +63,7 @@ public function testShouldDoNothingIfMessageHasTopicPropertySetOnPreReceive() public function testShouldDoNothingIfMessageHasCommandPropertySetOnPreReceive() { $message = new NullMessage(); - $message->setProperty(Config::COMMAND_PARAMETER, 'aCommand'); + $message->setProperty(Config::COMMAND, 'aCommand'); $context = new Context(new NullContext()); $context->setInteropMessage($message); @@ -88,7 +88,7 @@ public function testShouldDoNothingIfMessageHasCommandPropertySetOnPreReceive() public function testShouldDoNothingIfMessageHasProcessorPropertySetOnPreReceive() { $message = new NullMessage(); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'aProcessor'); + $message->setProperty(Config::PROCESSOR, 'aProcessor'); $context = new Context(new NullContext()); $context->setInteropMessage($message); diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php index e4ae8a658..2d21b904f 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php @@ -100,7 +100,7 @@ public function testShouldNotSetAnyPropertyIfProcessorNamePropertyAlreadySet() ; $message = new NullMessage(); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'non-router-processor'); + $message->setProperty(Config::PROCESSOR, 'non-router-processor'); $context = new Context($this->createContextMock()); $context->setInteropMessage($message); diff --git a/pkg/enqueue/Tests/Client/DelegateProcessorTest.php b/pkg/enqueue/Tests/Client/DelegateProcessorTest.php index 424206827..29b1031bf 100644 --- a/pkg/enqueue/Tests/Client/DelegateProcessorTest.php +++ b/pkg/enqueue/Tests/Client/DelegateProcessorTest.php @@ -33,7 +33,7 @@ public function testShouldProcessMessage() $session = $this->createContextMock(); $message = new NullMessage(); $message->setProperties([ - Config::PROCESSOR_PARAMETER => 'processor-name', + Config::PROCESSOR => 'processor-name', ]); $processor = $this->createProcessorMock(); diff --git a/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php b/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php index d5d4c257f..4e4cc62fd 100644 --- a/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/AmqpDriverTest.php @@ -170,7 +170,7 @@ public function testShouldResetPriorityAndExpirationAndNeverCallProducerDelivery ); $message = new Message(); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::TOPIC, 'topic'); $message->setExpire(123); $message->setPriority(MessagePriority::HIGH); @@ -349,10 +349,10 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi ], $transportMessage->getHeaders()); $this->assertEquals([ 'pkey' => 'pval', - 'X-Enqueue-Content-Type' => 'ContentType', - 'X-Enqueue-Priority' => MessagePriority::HIGH, - 'X-Enqueue-Expire' => 123, - 'enqueue.delay' => 345, + Config::CONTENT_TYPE => 'ContentType', + Config::PRIORITY => MessagePriority::HIGH, + Config::EXPIRE => 123, + Config::DELAY => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); diff --git a/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php b/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php index f145859a7..98b6c2285 100644 --- a/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php @@ -2,6 +2,7 @@ namespace Enqueue\Tests\Client\Driver; +use Enqueue\Client\Config; use Enqueue\Client\Driver\GenericDriver; use Enqueue\Client\DriverInterface; use Enqueue\Client\MessagePriority; @@ -68,10 +69,10 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi ], $transportMessage->getHeaders()); $this->assertEquals([ 'pkey' => 'pval', - 'X-Enqueue-Content-Type' => 'ContentType', - 'X-Enqueue-Priority' => MessagePriority::HIGH, - 'X-Enqueue-Expire' => 123, - 'enqueue.delay' => 345, + Config::CONTENT_TYPE => 'ContentType', + Config::PRIORITY => MessagePriority::HIGH, + Config::EXPIRE => 123, + Config::DELAY => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); diff --git a/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php b/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php index cf8a5f5d7..2d39018fa 100644 --- a/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php +++ b/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php @@ -197,9 +197,9 @@ public function testShouldCreateClientMessageFromTransportOne() $transportMessage->setBody('body'); $transportMessage->setHeaders(['hkey' => 'hval']); $transportMessage->setProperty('pkey', 'pval'); - $transportMessage->setProperty('X-Enqueue-Content-Type', 'theContentType'); - $transportMessage->setProperty('X-Enqueue-Expire', '22'); - $transportMessage->setProperty('X-Enqueue-Priority', MessagePriority::HIGH); + $transportMessage->setProperty(Config::CONTENT_TYPE, 'theContentType'); + $transportMessage->setProperty(Config::EXPIRE, '22'); + $transportMessage->setProperty(Config::PRIORITY, MessagePriority::HIGH); $transportMessage->setProperty('enqueue.delay', '44'); $transportMessage->setMessageId('theMessageId'); $transportMessage->setTimestamp(1000); @@ -284,7 +284,7 @@ public function testShouldSendMessageToRouter() ); $message = new Message(); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::TOPIC, 'topic'); $driver->sendToRouter($message); } @@ -323,7 +323,7 @@ public function testShouldNotInitDeliveryDelayOnSendMessageToRouter() $message = new Message(); $message->setDelay(456); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::TOPIC, 'topic'); $driver->sendToRouter($message); } @@ -362,7 +362,7 @@ public function testShouldNotInitTimeToLiveOnSendMessageToRouter() $message = new Message(); $message->setExpire(456); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::TOPIC, 'topic'); $driver->sendToRouter($message); } @@ -401,7 +401,7 @@ public function testShouldNotInitPriorityOnSendMessageToRouter() $message = new Message(); $message->setPriority(MessagePriority::HIGH); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::TOPIC, 'topic'); $driver->sendToRouter($message); } @@ -429,7 +429,7 @@ public function testThrowIfCommandSetOnSendToRouter() ); $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'aCommand'); + $message->setProperty(Config::COMMAND, 'aCommand'); $this->expectException(\LogicException::class); $this->expectExceptionMessage('Command must not be send to router but go directly to its processor.'); @@ -475,8 +475,8 @@ public function testShouldSendTopicMessageToProcessorToDefaultQueue() ); $message = new Message(); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::TOPIC, 'topic'); + $message->setProperty(Config::PROCESSOR, 'processor'); $driver->sendToProcessor($message); } @@ -519,8 +519,8 @@ public function testShouldSendTopicMessageToProcessorToCustomQueue() ); $message = new Message(); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::TOPIC, 'topic'); + $message->setProperty(Config::PROCESSOR, 'processor'); $driver->sendToProcessor($message); } @@ -569,8 +569,8 @@ public function testShouldInitDeliveryDelayIfDelayPropertyOnSendToProcessor() $message = new Message(); $message->setDelay(456); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::TOPIC, 'topic'); + $message->setProperty(Config::PROCESSOR, 'processor'); $driver->sendToProcessor($message); } @@ -619,8 +619,8 @@ public function testShouldSetInitTimeToLiveIfExpirePropertyOnSendToProcessor() $message = new Message(); $message->setExpire(678); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::TOPIC, 'topic'); + $message->setProperty(Config::PROCESSOR, 'processor'); $driver->sendToProcessor($message); } @@ -669,8 +669,8 @@ public function testShouldSetInitPriorityIfPriorityPropertyOnSendToProcessor() $message = new Message(); $message->setPriority(MessagePriority::HIGH); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::TOPIC, 'topic'); + $message->setProperty(Config::PROCESSOR, 'processor'); $driver->sendToProcessor($message); } @@ -694,8 +694,8 @@ public function testThrowIfNoRouteFoundForTopicMessageOnSendToProcessor() ); $message = new Message(); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::TOPIC, 'topic'); + $message->setProperty(Config::PROCESSOR, 'processor'); $this->expectException(\LogicException::class); $this->expectExceptionMessage('There is no route for topic "topic" and processor "processor"'); @@ -740,11 +740,11 @@ public function testShouldSetRouterProcessorIfProcessorPropertyEmptyOnSendToProc ); $message = new Message(); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); + $message->setProperty(Config::TOPIC, 'topic'); $driver->sendToProcessor($message); - $this->assertSame('router', $message->getProperty(Config::PROCESSOR_PARAMETER)); + $this->assertSame('router', $message->getProperty(Config::PROCESSOR)); } public function testShouldSendCommandMessageToProcessorToDefaultQueue() @@ -785,8 +785,8 @@ public function testShouldSendCommandMessageToProcessorToDefaultQueue() ); $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'command'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::COMMAND, 'command'); + $message->setProperty(Config::PROCESSOR, 'processor'); $driver->sendToProcessor($message); } @@ -829,8 +829,8 @@ public function testShouldSendCommandMessageToProcessorToCustomQueue() ); $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'command'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::COMMAND, 'command'); + $message->setProperty(Config::PROCESSOR, 'processor'); $driver->sendToProcessor($message); } @@ -854,8 +854,8 @@ public function testThrowIfNoRouteFoundForCommandMessageOnSendToProcessor() ); $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'command'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::COMMAND, 'command'); + $message->setProperty(Config::PROCESSOR, 'processor'); $this->expectException(\LogicException::class); $this->expectExceptionMessage('There is no route for command "command".'); @@ -900,12 +900,12 @@ public function testShouldOverwriteProcessorPropertySetByOneFromCommandRouteOnSe ); $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'command'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processorShouldBeOverwritten'); + $message->setProperty(Config::COMMAND, 'command'); + $message->setProperty(Config::PROCESSOR, 'processorShouldBeOverwritten'); $driver->sendToProcessor($message); - $this->assertSame('expectedProcessor', $message->getProperty(Config::PROCESSOR_PARAMETER)); + $this->assertSame('expectedProcessor', $message->getProperty(Config::PROCESSOR)); } public function testShouldNotInitDeliveryDelayOnSendMessageToProcessorIfPropertyNull() @@ -948,7 +948,7 @@ public function testShouldNotInitDeliveryDelayOnSendMessageToProcessorIfProperty ); $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'command'); + $message->setProperty(Config::COMMAND, 'command'); $message->setDelay(null); $driver->sendToProcessor($message); @@ -994,7 +994,7 @@ public function testShouldNotInitPriorityOnSendMessageToProcessorIfPropertyNull( ); $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'command'); + $message->setProperty(Config::COMMAND, 'command'); $message->setPriority(null); $driver->sendToProcessor($message); @@ -1040,7 +1040,7 @@ public function testShouldNotInitTimeToLiveOnSendMessageToProcessorIfPropertyNul ); $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'command'); + $message->setProperty(Config::COMMAND, 'command'); $message->setExpire(null); $driver->sendToProcessor($message); @@ -1058,7 +1058,7 @@ public function testThrowIfNeitherTopicNorCommandAreSentOnSendToProcessor() $this->expectExceptionMessage('Queue name parameter is required but is not set'); $message = new Message(); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::PROCESSOR, 'processor'); $this->expectException(\LogicException::class); $this->expectExceptionMessage('Either topic or command parameter must be set.'); @@ -1121,10 +1121,10 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi ], $transportMessage->getHeaders()); $this->assertEquals([ 'pkey' => 'pval', - 'X-Enqueue-Content-Type' => 'ContentType', - 'X-Enqueue-Priority' => MessagePriority::HIGH, - 'X-Enqueue-Expire' => 123, - 'enqueue.delay' => 345, + Config::CONTENT_TYPE => 'ContentType', + Config::PRIORITY => MessagePriority::HIGH, + Config::EXPIRE => 123, + Config::DELAY => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); @@ -1140,10 +1140,10 @@ protected function assertClientMessage(Message $clientMessage): void ], $clientMessage->getHeaders()); $this->assertArraySubset([ 'pkey' => 'pval', - 'X-Enqueue-Content-Type' => 'theContentType', - 'X-Enqueue-Expire' => '22', - 'X-Enqueue-Priority' => MessagePriority::HIGH, - 'enqueue.delay' => '44', + Config::CONTENT_TYPE => 'theContentType', + Config::EXPIRE => '22', + Config::PRIORITY => MessagePriority::HIGH, + Config::DELAY => '44', ], $clientMessage->getProperties()); $this->assertSame('theMessageId', $clientMessage->getMessageId()); $this->assertSame(22, $clientMessage->getExpire()); diff --git a/pkg/enqueue/Tests/Client/Driver/RabbitMqDriverTest.php b/pkg/enqueue/Tests/Client/Driver/RabbitMqDriverTest.php index eebb9b787..2f6e20a82 100644 --- a/pkg/enqueue/Tests/Client/Driver/RabbitMqDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/RabbitMqDriverTest.php @@ -2,6 +2,7 @@ namespace Enqueue\Tests\Client\Driver; +use Enqueue\Client\Config; use Enqueue\Client\Driver\AmqpDriver; use Enqueue\Client\Driver\GenericDriver; use Enqueue\Client\Driver\RabbitMqDriver; @@ -127,10 +128,10 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi ], $transportMessage->getHeaders()); $this->assertEquals([ 'pkey' => 'pval', - 'X-Enqueue-Content-Type' => 'ContentType', - 'X-Enqueue-Priority' => MessagePriority::HIGH, - 'X-Enqueue-Expire' => 123, - 'enqueue.delay' => 345, + Config::CONTENT_TYPE => 'ContentType', + Config::PRIORITY => MessagePriority::HIGH, + Config::EXPIRE => 123, + Config::DELAY => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); diff --git a/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php b/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php index 22cda4e72..5e6dc245e 100644 --- a/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php @@ -250,8 +250,8 @@ public function shouldSendMessageToDelayExchangeIfDelaySet() ); $message = new Message(); - $message->setProperty(Config::TOPIC_PARAMETER, 'topic'); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'processor'); + $message->setProperty(Config::TOPIC, 'topic'); + $message->setProperty(Config::PROCESSOR, 'processor'); $message->setDelay(10); $driver->sendToProcessor($message); @@ -540,10 +540,10 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi ], $transportMessage->getHeaders()); $this->assertEquals([ 'pkey' => 'pval', - 'X-Enqueue-Content-Type' => 'ContentType', - 'X-Enqueue-Priority' => MessagePriority::HIGH, - 'X-Enqueue-Expire' => 123, - 'enqueue.delay' => 345, + Config::CONTENT_TYPE => 'ContentType', + Config::PRIORITY => MessagePriority::HIGH, + Config::EXPIRE => 123, + Config::DELAY => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); diff --git a/pkg/enqueue/Tests/Client/Driver/StompDriverTest.php b/pkg/enqueue/Tests/Client/Driver/StompDriverTest.php index 0a3415c57..67764f3bb 100644 --- a/pkg/enqueue/Tests/Client/Driver/StompDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/StompDriverTest.php @@ -2,6 +2,7 @@ namespace Enqueue\Tests\Client\Driver; +use Enqueue\Client\Config; use Enqueue\Client\Driver\GenericDriver; use Enqueue\Client\Driver\StompDriver; use Enqueue\Client\DriverInterface; @@ -166,10 +167,10 @@ protected function assertTransportMessage(InteropMessage $transportMessage): voi ], $transportMessage->getHeaders()); $this->assertEquals([ 'pkey' => 'pval', - 'X-Enqueue-Content-Type' => 'ContentType', - 'X-Enqueue-Priority' => MessagePriority::HIGH, - 'X-Enqueue-Expire' => 123, - 'enqueue.delay' => 345, + Config::CONTENT_TYPE => 'ContentType', + Config::PRIORITY => MessagePriority::HIGH, + Config::EXPIRE => 123, + Config::DELAY => 345, ], $transportMessage->getProperties()); $this->assertSame('theMessageId', $transportMessage->getMessageId()); $this->assertSame(1000, $transportMessage->getTimestamp()); diff --git a/pkg/enqueue/Tests/Client/DriverPreSendTest.php b/pkg/enqueue/Tests/Client/DriverPreSendTest.php index 95ac891ac..d31ac17f1 100644 --- a/pkg/enqueue/Tests/Client/DriverPreSendTest.php +++ b/pkg/enqueue/Tests/Client/DriverPreSendTest.php @@ -48,7 +48,7 @@ public function testShouldAllowGetArgumentSetInConstructor() public function testShouldAllowGetCommand() { $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'theCommand'); + $message->setProperty(Config::COMMAND, 'theCommand'); $context = new DriverPreSend( $message, @@ -63,7 +63,7 @@ public function testShouldAllowGetCommand() public function testShouldAllowGetTopic() { $message = new Message(); - $message->setProperty(Config::TOPIC_PARAMETER, 'theTopic'); + $message->setProperty(Config::TOPIC, 'theTopic'); $context = new DriverPreSend( $message, diff --git a/pkg/enqueue/Tests/Client/PostSendTest.php b/pkg/enqueue/Tests/Client/PostSendTest.php index a68c12bdc..65860766e 100644 --- a/pkg/enqueue/Tests/Client/PostSendTest.php +++ b/pkg/enqueue/Tests/Client/PostSendTest.php @@ -48,7 +48,7 @@ public function testShouldAllowGetArgumentSetInConstructor() public function testShouldAllowGetCommand() { $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'theCommand'); + $message->setProperty(Config::COMMAND, 'theCommand'); $context = new PostSend( $message, @@ -63,7 +63,7 @@ public function testShouldAllowGetCommand() public function testShouldAllowGetTopic() { $message = new Message(); - $message->setProperty(Config::TOPIC_PARAMETER, 'theTopic'); + $message->setProperty(Config::TOPIC, 'theTopic'); $context = new PostSend( $message, diff --git a/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php b/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php index ea1855036..92885aa12 100644 --- a/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php +++ b/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php @@ -136,7 +136,7 @@ public function testShouldSendCommandWithReplyAndCustomReplyQueueAndCorrelationI public function testShouldOverwriteExpectedMessageProperties() { $message = new Message(); - $message->setProperty(Config::COMMAND_PARAMETER, 'commandShouldBeOverwritten'); + $message->setProperty(Config::COMMAND, 'commandShouldBeOverwritten'); $message->setScope('scopeShouldBeOverwritten'); $driver = $this->createDriverStub(); @@ -299,8 +299,8 @@ public function testShouldSendCommandToApplicationRouter() ->method('sendToProcessor') ->willReturnCallback(function (Message $message) { self::assertSame('aBody', $message->getBody()); - self::assertNull($message->getProperty(Config::PROCESSOR_PARAMETER)); - self::assertSame('command', $message->getProperty(Config::COMMAND_PARAMETER)); + self::assertNull($message->getProperty(Config::PROCESSOR)); + self::assertSame('command', $message->getProperty(Config::COMMAND)); }) ; @@ -313,7 +313,7 @@ public function testThrowWhenProcessorNamePropertySetToApplicationRouter() $message = new Message(); $message->setBody('aBody'); $message->setScope(Message::SCOPE_APP); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'aCustomProcessor'); + $message->setProperty(Config::PROCESSOR, 'aCustomProcessor'); $driver = $this->createDriverStub(); $driver diff --git a/pkg/enqueue/Tests/Client/ProducerSendEventTest.php b/pkg/enqueue/Tests/Client/ProducerSendEventTest.php index e957e16c5..0fdd780c9 100644 --- a/pkg/enqueue/Tests/Client/ProducerSendEventTest.php +++ b/pkg/enqueue/Tests/Client/ProducerSendEventTest.php @@ -45,7 +45,7 @@ public function testShouldSendEventToRouter() public function testShouldOverwriteTopicProperty() { $message = new Message(); - $message->setProperty(Config::TOPIC_PARAMETER, 'topicShouldBeOverwritten'); + $message->setProperty(Config::TOPIC, 'topicShouldBeOverwritten'); $driver = $this->createDriverStub(); @@ -198,7 +198,7 @@ public function testThrowIfSendEventToMessageBusWithProcessorNamePropertySet() { $message = new Message(); $message->setBody(''); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'aProcessor'); + $message->setProperty(Config::PROCESSOR, 'aProcessor'); $driver = $this->createDriverStub(); $driver @@ -235,7 +235,7 @@ public function testShouldSendEventToApplicationRouter() self::assertSame('aBody', $message->getBody()); // null means a driver sends a message to router processor. - self::assertNull($message->getProperty(Config::PROCESSOR_PARAMETER)); + self::assertNull($message->getProperty(Config::PROCESSOR)); }) ; @@ -248,7 +248,7 @@ public function testThrowWhenProcessorNamePropertySetToApplicationRouter() $message = new Message(); $message->setBody('aBody'); $message->setScope(Message::SCOPE_APP); - $message->setProperty(Config::PROCESSOR_PARAMETER, 'aCustomProcessor'); + $message->setProperty(Config::PROCESSOR, 'aCustomProcessor'); $driver = $this->createDriverStub(); $driver diff --git a/pkg/enqueue/Tests/Client/RouterProcessorTest.php b/pkg/enqueue/Tests/Client/RouterProcessorTest.php index 0c245d446..3a4596b0f 100644 --- a/pkg/enqueue/Tests/Client/RouterProcessorTest.php +++ b/pkg/enqueue/Tests/Client/RouterProcessorTest.php @@ -53,7 +53,7 @@ public function testShouldRejectIfCommandSet() $router = new RouterProcessor($this->createDriverStub()); $message = new NullMessage(); - $message->setProperty(Config::COMMAND_PARAMETER, 'aCommand'); + $message->setProperty(Config::COMMAND, 'aCommand'); $result = $router->process($message, new NullContext()); @@ -66,7 +66,7 @@ public function testShouldRouteOriginalMessageToAllRecipients() $message = new NullMessage(); $message->setBody('theBody'); $message->setHeaders(['aHeader' => 'aHeaderVal']); - $message->setProperties(['aProp' => 'aPropVal', Config::TOPIC_PARAMETER => 'theTopicName']); + $message->setProperties(['aProp' => 'aPropVal', Config::TOPIC => 'theTopicName']); /** @var Message[] $routedMessages */ $routedMessages = new \ArrayObject(); @@ -103,9 +103,9 @@ public function testShouldRouteOriginalMessageToAllRecipients() $this->assertContainsOnly(Message::class, $routedMessages); $this->assertCount(3, $routedMessages); - $this->assertSame('aFooProcessor', $routedMessages[0]->getProperty(Config::PROCESSOR_PARAMETER)); - $this->assertSame('aBarProcessor', $routedMessages[1]->getProperty(Config::PROCESSOR_PARAMETER)); - $this->assertSame('aBazProcessor', $routedMessages[2]->getProperty(Config::PROCESSOR_PARAMETER)); + $this->assertSame('aFooProcessor', $routedMessages[0]->getProperty(Config::PROCESSOR)); + $this->assertSame('aBarProcessor', $routedMessages[1]->getProperty(Config::PROCESSOR)); + $this->assertSame('aBazProcessor', $routedMessages[2]->getProperty(Config::PROCESSOR)); } public function testShouldDoNothingIfNoRoutes() @@ -113,7 +113,7 @@ public function testShouldDoNothingIfNoRoutes() $message = new NullMessage(); $message->setBody('theBody'); $message->setHeaders(['aHeader' => 'aHeaderVal']); - $message->setProperties(['aProp' => 'aPropVal', Config::TOPIC_PARAMETER => 'theTopicName']); + $message->setProperties(['aProp' => 'aPropVal', Config::TOPIC => 'theTopicName']); /** @var Message[] $routedMessages */ $routedMessages = new \ArrayObject(); @@ -151,7 +151,7 @@ public function testShouldDoNotModifyOriginalMessage() $message = new NullMessage(); $message->setBody('theBody'); $message->setHeaders(['aHeader' => 'aHeaderVal']); - $message->setProperties(['aProp' => 'aPropVal', Config::TOPIC_PARAMETER => 'theTopicName']); + $message->setProperties(['aProp' => 'aPropVal', Config::TOPIC => 'theTopicName']); /** @var Message[] $routedMessages */ $routedMessages = new \ArrayObject(); @@ -183,7 +183,7 @@ public function testShouldDoNotModifyOriginalMessage() $this->assertEquals(Result::ACK, $result->getStatus()); $this->assertSame('theBody', $message->getBody()); - $this->assertSame(['aProp' => 'aPropVal', Config::TOPIC_PARAMETER => 'theTopicName'], $message->getProperties()); + $this->assertSame(['aProp' => 'aPropVal', Config::TOPIC => 'theTopicName'], $message->getProperties()); $this->assertSame(['aHeader' => 'aHeaderVal'], $message->getHeaders()); } diff --git a/pkg/fs/Tests/Functional/FsConsumerTest.php b/pkg/fs/Tests/Functional/FsConsumerTest.php index 782053e0a..50cab8533 100644 --- a/pkg/fs/Tests/Functional/FsConsumerTest.php +++ b/pkg/fs/Tests/Functional/FsConsumerTest.php @@ -137,7 +137,7 @@ public function testShouldThrowExceptionForTheCorruptedQueueFile() $context->purgeQueue($queue); $context->workWithFile($queue, 'a+', function (FsDestination $destination, $file) { - fwrite($file, '|{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_red_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"46fdc345-5d0c-426e-95ac-227c7e657839","timestamp":1505379216,"reply_to":null,"correlation_id":""}} |{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_black_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"c4d60e39-3a8c-42df-b536-c8b7c13e006d","timestamp":1505379216,"reply_to":null,"correlation_id":""}} |{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_green_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"3a6aa176-c879-4435-9626-c48e0643defa","timestamp":1505379216,"reply_to":null,"correlation_id":""}}'); + fwrite($file, '|{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_red_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic_name":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"46fdc345-5d0c-426e-95ac-227c7e657839","timestamp":1505379216,"reply_to":null,"correlation_id":""}} |{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_black_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic_name":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"c4d60e39-3a8c-42df-b536-c8b7c13e006d","timestamp":1505379216,"reply_to":null,"correlation_id":""}} |{"body":"{\"path\":\"\\\/p\\\/r\\\/pr_swoppad_6_4910_green_1.jpg\",\"filters\":null,\"force\":false}","properties":{"enqueue.topic_name":"liip_imagine_resolve_cache"},"headers":{"content_type":"application\/json","message_id":"3a6aa176-c879-4435-9626-c48e0643defa","timestamp":1505379216,"reply_to":null,"correlation_id":""}}'); }); $consumer = $context->createConsumer($queue); @@ -182,13 +182,13 @@ public function testShouldUnEscapeDelimiterSymbolsInMessageBody() $queue = $context->createQueue('fs_test_queue'); $context->purgeQueue($queue); - $message = $this->fsContext->createMessage(' |{"body":"aMessageData","properties":{"enqueue.topic":"user_updated"},"headers":{"content_type":"text\/plain","message_id":"90979b6c-d9ff-4b39-9938-878b83a95360","timestamp":1519899428,"reply_to":null,"correlation_id":""}}'); + $message = $this->fsContext->createMessage(' |{"body":"aMessageData","properties":{"enqueue.topic_name":"user_updated"},"headers":{"content_type":"text\/plain","message_id":"90979b6c-d9ff-4b39-9938-878b83a95360","timestamp":1519899428,"reply_to":null,"correlation_id":""}}'); $this->fsContext->createProducer()->send($queue, $message); $this->assertSame(0, strlen(file_get_contents(sys_get_temp_dir().'/fs_test_queue')) % 64); $this->assertSame( - ' |{"body":" \|\{\"body\":\"aMessageData\",\"properties\":{\"enqueue.topic\":\"user_updated\"},\"headers\":{\"content_type\":\"text\\\\\/plain\",\"message_id\":\"90979b6c-d9ff-4b39-9938-878b83a95360\",\"timestamp\":1519899428,\"reply_to\":null,\"correlation_id\":\"\"}}","properties":[],"headers":[]}', + ' |{"body":" \|\{\"body\":\"aMessageData\",\"properties\":{\"enqueue.topic_name\":\"user_updated\"},\"headers\":{\"content_type\":\"text\\\\\/plain\",\"message_id\":\"90979b6c-d9ff-4b39-9938-878b83a95360\",\"timestamp\":1519899428,\"reply_to\":null,\"correlation_id\":\"\"}}","properties":[],"headers":[]}', file_get_contents(sys_get_temp_dir().'/fs_test_queue') ); @@ -196,6 +196,6 @@ public function testShouldUnEscapeDelimiterSymbolsInMessageBody() $message = $consumer->receiveNoWait(); - $this->assertSame(' |{"body":"aMessageData","properties":{"enqueue.topic":"user_updated"},"headers":{"content_type":"text\/plain","message_id":"90979b6c-d9ff-4b39-9938-878b83a95360","timestamp":1519899428,"reply_to":null,"correlation_id":""}}', $message->getBody()); + $this->assertSame(' |{"body":"aMessageData","properties":{"enqueue.topic_name":"user_updated"},"headers":{"content_type":"text\/plain","message_id":"90979b6c-d9ff-4b39-9938-878b83a95360","timestamp":1519899428,"reply_to":null,"correlation_id":""}}', $message->getBody()); } } From acefa7a11bfd55b627ab7532e5e8ea6db88fdc4b Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Mon, 1 Oct 2018 17:36:49 +0300 Subject: [PATCH 4/4] fix cs --- pkg/enqueue-bundle/DependencyInjection/Configuration.php | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/enqueue-bundle/DependencyInjection/Configuration.php b/pkg/enqueue-bundle/DependencyInjection/Configuration.php index ce2c62bde..df0b3f6d7 100644 --- a/pkg/enqueue-bundle/DependencyInjection/Configuration.php +++ b/pkg/enqueue-bundle/DependencyInjection/Configuration.php @@ -2,7 +2,6 @@ namespace Enqueue\Bundle\DependencyInjection; -use Enqueue\Client\Config; use Enqueue\Client\RouterProcessor; use Enqueue\Symfony\DependencyInjection\TransportFactory; use Symfony\Component\Config\Definition\Builder\TreeBuilder;