Skip to content

Commit af7d75d

Browse files
committed
SWR-18338: RabbitMQ Switch Logic
1 parent f3e7071 commit af7d75d

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"extra": {
3636
"branch-alias": {
37-
"dev-master": "1.23-dev"
37+
"dev-master": "1.24-dev"
3838
},
3939
"laravel": {
4040
"providers": [

src/VhostsConsumers/AbstractVhostsConsumer.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -566,24 +566,21 @@ protected function updateLastProcessedAt()
566566
*/
567567
protected function initConnection(): RabbitMQQueue
568568
{
569-
if ($this->connection) {
569+
if ($this->channel) {
570570
try {
571-
$this->connection->close();
571+
$this->channel->close();
572572
} catch (\Exception $e) {
573+
// Ignore close errors
573574
}
574-
$this->connection = null;
575+
$this->channel = null;
575576
}
576577

577578
$connection = $this->manager->connection(
578579
ConnectionNameDto::getVhostConnectionName($this->currentVhostName, $this->configConnectionName)
579580
);
580581

581582
try {
582-
if (!$connection->isConnected()) {
583-
$connection->reconnect();
584-
}
585-
586-
$channel = $connection->getChannel();
583+
$channel = $connection->getChannel(true);
587584

588585
$this->currentConnectionName = $connection->getConnectionName();
589586

0 commit comments

Comments
 (0)