Skip to content

Commit 7a5d2f0

Browse files
committed
fix router topic name
1 parent 6aa76f4 commit 7a5d2f0

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

Diff for: pkg/enqueue/Client/Config.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function getRouterProcessorName()
103103
*/
104104
public function createTransportRouterTopicName($name)
105105
{
106-
return trim(strtolower(trim($this->prefix).'.'.trim($name)), '.');
106+
return $this->getDestinationName($name);
107107
}
108108

109109
/**
@@ -113,7 +113,7 @@ public function createTransportRouterTopicName($name)
113113
*/
114114
public function createTransportQueueName($name)
115115
{
116-
return trim(strtolower(trim($this->prefix).'.'.trim($this->appName).'.'.trim($name)), '.');
116+
return $this->getDestinationName($name);
117117
}
118118

119119
/**
@@ -154,4 +154,14 @@ public static function create(
154154
$routerProcessorName ?: 'router'
155155
);
156156
}
157+
158+
/**
159+
* @param string $name
160+
*
161+
* @return string
162+
*/
163+
private function getDestinationName($name)
164+
{
165+
return trim(strtolower(trim($this->prefix).'.'.trim($this->appName).'.'.trim($name)), '.');
166+
}
157167
}

Diff for: pkg/enqueue/Tests/Client/ConfigTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testShouldCreateRouterTopicName()
7373
'aRouterProcessorName'
7474
);
7575

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

7979
public function testShouldCreateProcessorQueueName()

Diff for: pkg/stomp/Tests/Client/RabbitMqStompDriverTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ public function testShouldSetupBroker()
483483
$managementClient
484484
->expects($this->at(0))
485485
->method('declareExchange')
486-
->with('prefix.routertopic', [
486+
->with('prefix.app.routertopic', [
487487
'type' => 'fanout',
488488
'durable' => true,
489489
'auto_delete' => false,
@@ -503,7 +503,7 @@ public function testShouldSetupBroker()
503503
$managementClient
504504
->expects($this->at(2))
505505
->method('bind')
506-
->with('prefix.routertopic', 'prefix.app.routerqueue', 'prefix.app.routerqueue')
506+
->with('prefix.app.routertopic', 'prefix.app.routerqueue', 'prefix.app.routerqueue')
507507
;
508508
$managementClient
509509
->expects($this->at(3))
@@ -528,7 +528,7 @@ public function testShouldSetupBroker()
528528
$logger
529529
->expects($this->at(0))
530530
->method('debug')
531-
->with('[RabbitMqStompDriver] Declare router exchange: prefix.routertopic')
531+
->with('[RabbitMqStompDriver] Declare router exchange: prefix.app.routertopic')
532532
;
533533
$logger
534534
->expects($this->at(1))
@@ -538,7 +538,7 @@ public function testShouldSetupBroker()
538538
$logger
539539
->expects($this->at(2))
540540
->method('debug')
541-
->with('[RabbitMqStompDriver] Bind router queue to exchange: prefix.app.routerqueue -> prefix.routertopic')
541+
->with('[RabbitMqStompDriver] Bind router queue to exchange: prefix.app.routerqueue -> prefix.app.routertopic')
542542
;
543543
$logger
544544
->expects($this->at(3))

0 commit comments

Comments
 (0)