Skip to content
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

adding reconnect to publisher #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

muhammedeminakbulut
Copy link

the connection fails with rong lunning processes. this should fix the issue and reconnect when connection is lost.

the connection fails with rong lunning processes. this should fix the issue and reconnect when connection is lost.

if (!$this->exchange->getConnection()->isConnected()) {
$this->exchange->getConnection()->reconnect();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this really help? if I look into the called method it just returns the status code of the last command that was sent, which doesn't help if the connection is closed after that

@@ -59,7 +59,11 @@ public function publish(Message $message, \DateTime $date = null, $flags = Excha
$body = $message->getBody();
$route = $message->getRoutingKey();
$props = $message->getProperties()->toArray();


if (!$this->exchange->getConnection()->isConnected()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right place for this. The publisher just needs to publish. This fix is useful in a specific context (long-running processes), I think you should incorporate it into your process instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants