Skip to content

Commit

Permalink
fix router topic name
Browse files Browse the repository at this point in the history
  • Loading branch information
bendavies committed Mar 30, 2017
1 parent 6aa76f4 commit c10f0de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
14 changes: 12 additions & 2 deletions pkg/enqueue/Client/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function getRouterProcessorName()
*/
public function createTransportRouterTopicName($name)
{
return trim(strtolower(trim($this->prefix).'.'.trim($name)), '.');
return $this->getQueueName($name);
}

/**
Expand All @@ -113,7 +113,7 @@ public function createTransportRouterTopicName($name)
*/
public function createTransportQueueName($name)
{
return trim(strtolower(trim($this->prefix).'.'.trim($this->appName).'.'.trim($name)), '.');
return $this->getQueueName($name);
}

/**
Expand Down Expand Up @@ -154,4 +154,14 @@ public static function create(
$routerProcessorName ?: 'router'
);
}

/**
* @param string $name
*
* @return string
*/
private function getQueueName($name)
{
return trim(strtolower(trim($this->prefix).'.'.trim($this->appName).'.'.trim($name)), '.');
}
}
2 changes: 1 addition & 1 deletion pkg/enqueue/Tests/Client/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function testShouldCreateRouterTopicName()
'aRouterProcessorName'
);

$this->assertEquals('aprefix.aname', $config->createTransportRouterTopicName('aName'));
$this->assertEquals('aprefix.aapp.aname', $config->createTransportRouterTopicName('aName'));
}

public function testShouldCreateProcessorQueueName()
Expand Down
8 changes: 4 additions & 4 deletions pkg/stomp/Tests/Client/RabbitMqStompDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ public function testShouldSetupBroker()
$managementClient
->expects($this->at(0))
->method('declareExchange')
->with('prefix.routertopic', [
->with('prefix.app.routertopic', [
'type' => 'fanout',
'durable' => true,
'auto_delete' => false,
Expand All @@ -503,7 +503,7 @@ public function testShouldSetupBroker()
$managementClient
->expects($this->at(2))
->method('bind')
->with('prefix.routertopic', 'prefix.app.routerqueue', 'prefix.app.routerqueue')
->with('prefix.app.routertopic', 'prefix.app.routerqueue', 'prefix.app.routerqueue')
;
$managementClient
->expects($this->at(3))
Expand All @@ -528,7 +528,7 @@ public function testShouldSetupBroker()
$logger
->expects($this->at(0))
->method('debug')
->with('[RabbitMqStompDriver] Declare router exchange: prefix.routertopic')
->with('[RabbitMqStompDriver] Declare router exchange: prefix.app.routertopic')
;
$logger
->expects($this->at(1))
Expand All @@ -538,7 +538,7 @@ public function testShouldSetupBroker()
$logger
->expects($this->at(2))
->method('debug')
->with('[RabbitMqStompDriver] Bind router queue to exchange: prefix.app.routerqueue -> prefix.routertopic')
->with('[RabbitMqStompDriver] Bind router queue to exchange: prefix.app.routerqueue -> prefix.app.routertopic')
;
$logger
->expects($this->at(3))
Expand Down

0 comments on commit c10f0de

Please sign in to comment.