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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

$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


return $this->exchange->publish($body, $route, $flags, $props);
}
}