-
Notifications
You must be signed in to change notification settings - Fork 394
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
Feature/support-reconnect #531
Conversation
…eature/support-octane-reconnect
…eature/support-octane-reconnect
…' into feature/support-octane-reconnect
…eature/support-octane-reconnect
This reverts commit 7897f77.
…eature/support-octane-reconnect
Laravel: 10.4.1 RabbitMQ Server Config: Laravel queue.php config: 'options' => [
'connection_timeout' => 0.7,
'heartbeat' => 10,
], Octane vs RabbitMQ only worked with this PR. These exceptions still appear with heartbeat: PhpAmqpLib\Exception\AMQPConnectionClosedException: CHANNEL_ERROR - expected 'channel.open'(60, 40)
PhpAmqpLib\Exception\AMQPHeartbeatMissedException: Missed server heartbeat in vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/AbstractIO.php:167 Simply trace: #9 vendor/vladimir-yuldashev/laravel-queue-rabbitmq/src/Queue/RabbitMQQueue.php(410): PhpAmqpLib\Connection\AbstractConnection->channel()
#10 vendor/vladimir-yuldashev/laravel-queue-rabbitmq/src/Queue/RabbitMQQueue.php(705): VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue->isQueueExists('queue.name')
#11 vendor/vladimir-yuldashev/laravel-queue-rabbitmq/src/Queue/RabbitMQQueue.php(121): VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue->declareDestination('queue.name', '', 'direct')
#12 vendor/vladimir-yuldashev/laravel-queue-rabbitmq/src/Queue/RabbitMQQueue.php(107): VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue->pushRaw('{"uuid":"ace2d8...', 'queue.name') The solution was to add a method trait ReconnectTrait
{
protected function publishBasic($msg, $exchange = '', $destination = '', $mandatory = false, $immediate = false, $ticket = null): void
{
try {
parent::publishBasic($msg, $exchange, $destination, $mandatory, $immediate, $ticket);
} catch (AMQPConnectionClosedException|AMQPChannelClosedException) {
$this->reconnect();
parent::publishBasic($msg, $exchange, $destination, $mandatory, $immediate, $ticket);
}
}
protected function publishBatch(): void
{
try {
parent::publishBatch();
} catch (AMQPConnectionClosedException|AMQPChannelClosedException) {
$this->reconnect();
parent::publishBatch();
}
}
public function isQueueExists(string $name = null): bool
{
try {
return parent::isQueueExists($name);
} catch (AMQPConnectionClosedException|AMQPChannelClosedException) {
$this->reconnect();
return parent::isQueueExists($name);
}
}
} |
…eature/support-octane-reconnect
@matom20 Thanks for your input. Based on your input, the issue is bigger. The same applies for methods: size(), isExchangeExists() and purge().
In PR #528, i will extract/refactor a method, for creation of Channel. This can then be overwriten |
…eature/support-octane-reconnect
- issue #460 - rework based on [comment](#531 (comment))
@johnabil, @matom20 also @khepin and others..... In this PR, "a" solution to support These are my "2 cents" on how to solve octane with reconnection abbilities. But, in my humble opinion you don't and never want to reconnect in this way. Workers or Connections should always die. So the managers in place (like: cli workers, horizon or others) can manage these workers/connections and cleanup or handle all logic.
And of course there will be cases you won't want this to happen but that is a choice of a developer, in my opinion.
As for Octane: we should find a solution, the channel is not requested on a dead connection.
Also see issue: #460 |
…' into feature/support-reconnect # Conflicts: # README.md
Based on my last comment above #531 (comment) I added:
|
@adm-bome I think we need to be sure with couple of checks like:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Issue: #460
On-top of: #528
proposal branch: https://github.com/vyuldashev/laravel-queue-rabbitmq/compare/octane?expand=1