-
Notifications
You must be signed in to change notification settings - Fork 47
implement queue release delay #6
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
src/Job.php
Outdated
|
||
$requeueMessage = clone $this->psrMessage; | ||
$requeueMessage->setProperty('x-attempts', $this->attempts() + 1); | ||
|
||
$this->psrContext->createProducer()->send($this->psrConsumer->getQueue(), $requeueMessage); | ||
$this->psrContext->createProducer() | ||
->setDeliveryDelay($this->secondsUntil($delay)) |
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.
the setter can throw an exception in case delaying is not supported. I think we should $this->psrConsumer->acknowledge($this->psrMessage);
before trying to requeue.
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.
the setter can throw an exception in case delaying is not supported.
i think we need an api for that, is it alright to have something like
trait DelayStrategyAwareTrait
{
// ..............
public function delayable()
{
return $this->delayStrategy ? true : false;
}
}
also my pr code should check for DelayStrategyAware
contract`
I think we should $this->psrConsumer->acknowledge($this->psrMessage); before trying to requeue
yes i agree
src/Job.php
Outdated
$this->psrContext->createProducer()->send($this->psrConsumer->getQueue(), $requeueMessage); | ||
$producer = $this->psrContext->createProducer(); | ||
|
||
if ($producer instanceof DelayStrategyAware && $producer->delayable()) { |
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.
what is $producer->delayable()
? There is no such method?
$producer instanceof DelayStrategyAware
makes sense only for AMQP transports.
It'd be better to try always setDeliveryDelay and catch an exception DeliveryDelayNotSupported (or something like this)>
sorry i'm so clumsy, if you want to close this PR and do this in your own implementation, i'd me more than happy to do that, thank you
$delay
unit is in second