Skip to content

Commit 3d147f3

Browse files
committed
MCP-771: [MCP-608] Multiple consumers prototype development
- Fix Unknown connection name amqp error;
1 parent d3aec1b commit 3d147f3

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

app/code/Magento/MessageQueue/Model/Cron/ConsumersRunner.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,21 @@ public function run()
147147
$this->shellBackground->execute($command, $arguments);
148148
}
149149
} else {
150-
if ($this->lockManager->isLocked(md5($consumer->getName()))) { //phpcs:ignore
151-
return false;
152-
}
153-
154-
$arguments = [
155-
$consumer->getName(),
156-
'--single-thread'
157-
];
150+
if (!$this->lockManager->isLocked(md5($consumer->getName()))) { //phpcs:ignore
151+
$arguments = [
152+
$consumer->getName(),
153+
'--single-thread'
154+
];
158155

159-
if ($maxMessages) {
160-
$arguments[] = '--max-messages=' . min($consumer->getMaxMessages() ?? $maxMessages, $maxMessages);
161-
}
156+
if ($maxMessages) {
157+
$arguments[] = '--max-messages=' . min($consumer->getMaxMessages() ?? $maxMessages, $maxMessages);
158+
}
162159

163-
$command = $php . ' ' . BP . '/bin/magento queue:consumers:start %s %s'
164-
. ($maxMessages ? ' %s' : '');
160+
$command = $php . ' ' . BP . '/bin/magento queue:consumers:start %s %s'
161+
. ($maxMessages ? ' %s' : '');
165162

166-
$this->shellBackground->execute($command, $arguments);
163+
$this->shellBackground->execute($command, $arguments);
164+
}
167165
}
168166
}
169167
}

app/code/Magento/WebapiAsync/etc/queue_consumer.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd">
10-
<consumer name="async.operations.all" queue="async.operations.all" connection="amqp"
10+
<consumer name="async.operations.all" queue="async.operations.all" connection="db"
1111
consumerInstance="Magento\AsynchronousOperations\Model\MassConsumer"/>
12-
</config>
12+
</config>

0 commit comments

Comments
 (0)