Skip to content

Changes SetRouterPropertiesExtension to use the driver to generate the queue name #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public function onPreReceived(Context $context)
}

$config = $this->driver->getConfig();
if ($context->getPsrQueue()->getQueueName() != $config->createTransportQueueName($config->getRouterQueueName())) {
$queue = $this->driver->createQueue($config->getRouterQueueName());
if ($context->getPsrQueue()->getQueueName() != $queue->getQueueName()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function testCouldBeConstructedWithRequiredArguments()
public function testShouldSetRouterProcessorPropertyIfNotSetAndOnRouterQueue()
{
$config = Config::create('test', '', '', 'router-queue', '', 'router-processor-name');
$queue = new NullQueue('test.router-queue');

$driver = $this->createDriverMock();
$driver
Expand All @@ -38,6 +39,12 @@ public function testShouldSetRouterProcessorPropertyIfNotSetAndOnRouterQueue()
->willReturn($config)
;

$driver
->expects($this->once())
->method('createQueue')
->willReturn($queue)
;

$message = new NullMessage();

$context = new Context($this->createPsrContextMock());
Expand All @@ -56,6 +63,7 @@ public function testShouldSetRouterProcessorPropertyIfNotSetAndOnRouterQueue()
public function testShouldNotSetRouterProcessorPropertyIfNotSetAndNotOnRouterQueue()
{
$config = Config::create('test', '', '', 'router-queue', '', 'router-processor-name');
$queue = new NullQueue('test.router-queue');

$driver = $this->createDriverMock();
$driver
Expand All @@ -64,6 +72,12 @@ public function testShouldNotSetRouterProcessorPropertyIfNotSetAndNotOnRouterQue
->willReturn($config)
;

$driver
->expects($this->once())
->method('createQueue')
->willReturn($queue)
;

$message = new NullMessage();

$context = new Context($this->createPsrContextMock());
Expand Down