-
Notifications
You must be signed in to change notification settings - Fork 47
Add persistent functionality #7
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
Conversation
I think it would be better to always use persistent queues for AMQP\RabbitMQ transports. Something like this would be great: <?php
use Interop\Amqp\AmqpMessage;
if ($message instanceof AmqpMessage) {
$message->setDeliveryMode(AmqpMessage::DELIVERY_MODE_PERSISTENT);
} |
Updated, please check |
src/Queue.php
Outdated
@@ -56,9 +56,15 @@ public function push($job, $data = '', $queue = null) | |||
*/ | |||
public function pushRaw($payload, $queue = null, array $options = []) | |||
{ | |||
$message = $this->psrContext->createMessage($payload); | |||
|
|||
if ($message instanceof \Interop\Amqp\Impl\AmqpMessage) { |
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.
could you import namespace.
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.
For interface \Interop\Amqp\AmqpMessage
or implementation Interop\Amqp\AmqpMessage
?
We can't use both or I could use an alias. Which you prefer?
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.
use Interop\Amqp\AmqpMessage;
if ($message instanceof AmqpMessage) {
RabbitMQ has persistent message functionality that has not been serviced.
To use it, just add to your app/Jobs/SomeJob.php field
$persistent = true
. After that when you restart RabbitMQ message still be in a queue.