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

Should use popMessage for multiple Queue Worker #7

Open
PhearZero opened this issue Sep 14, 2021 · 0 comments
Open

Should use popMessage for multiple Queue Worker #7

PhearZero opened this issue Sep 14, 2021 · 0 comments

Comments

@PhearZero
Copy link

PhearZero commented Sep 14, 2021

The workers->work interface could use popMessage instead of receiveMessage. This way a Queue can be processed in parallel. It could be optimized it in a way where we have a $parallel parameter flag and|or max_retries.

...
$message = $this->rsmq->popMessage($this->queue);
if (!($message instanceof Message)) {
    sleep($sleep);
    continue;
}
$this->received++;
$result = $this->executor->__invoke($message);
if ($result === true) {
    $this->successful++;
} else {
    $this->failed++;
    $this->rsmq->sendMessage($this->queue, $message->getMessage());
}
...

$message = $this->rsmq->receiveMessage($this->queue);

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

No branches or pull requests

1 participant