-
-
Notifications
You must be signed in to change notification settings - Fork 289
Implementation of aws SQS #134
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/drivers/sqs/Command.php
Outdated
| use yii\queue\cli\Command as CliCommand; | ||
|
|
||
| /** | ||
| * Manages application gearman-queue. |
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.
This class is full copy of https://github.com/yiisoft/yii2-queue/blob/master/src/drivers/gearman/Command.php
src/drivers/sqs/Queue.php
Outdated
| return $this->_client; | ||
| } | ||
|
|
||
| private $_client; |
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.
properties should be declared before methods
| } | ||
|
|
||
| /** | ||
| * Set the visibilty to reserve message |
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.
Please, correct phpdoc of all methods.
src/drivers/sqs/Queue.php
Outdated
| */ | ||
| protected function getClient() | ||
| { | ||
| if ($this->key && $this->secret) |
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.
By PSR-2, open bracket should start in the same line.
| /** | ||
| * @inheritdoc | ||
| */ | ||
| protected function pushMessage($message, $ttr, $delay, $priority) |
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.
This method is used anywhere ?
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.
As I know it's used here
Line 146 in 967b0e1
| $event->id = $this->pushMessage($message, $event->ttr, $event->delay, $event->priority); |
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.
sorry, i didn't notice.
src/drivers/sqs/Queue.php
Outdated
| $receiptHandle = $payload['ReceiptHandle']; | ||
| $this->getClient()->changeMessageVisibility(array( | ||
| 'QueueUrl' => $this->url, | ||
| 'ReceiptHandle' => $queue_handle, |
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.
probably this variable should be $receiptHandle ?
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.
My bad!, Fixing it.
| */ | ||
| public function listen() | ||
| { | ||
| $this->run(); |
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.
I think this method should do the same as in other queue drivers. $queue->listen() should run an infinite loop with timeout (sleep) to use as a daemon, regardless of payload existence.
|
Hi, will be there any progress with this PR? |
|
suggest to base64_encode, and base64_decode for the MessageBody & Payload's Body, as SQS will throw error for PhpSerializer string, due to some characters are not allowed. |
|
@ryusoft , @elitemaks, Will review and update here accordingly. I am going to push this class in one of testing envoirment this week and if everything fine, will move it to production replacing db queue. |
|
Example of error messages: exception 'Aws\Sqs\Exception\SqsException' with message 'Error executing "SendMessage" on "https://sqs.xxx.amazonaws.com/xxxxxxxxx/qqq"; AWS HTTP error: Client error: I (truncated...)
|
| 'MessageBody' => "$ttr;$message", | ||
| ]); | ||
|
|
||
| if ($model !== null) { |
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.
if ($model === null) {
return false;
}
return $model['MessageId'];| */ | ||
| private function release($payload) | ||
| { | ||
| if (!empty($payload['ReceiptHandle'])) { |
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.
if (empty($payload['ReceiptHandle'])) {
return false;
}
// rest of the code here|
@manoj-malviya Hi, is there any progress? There are several requests for changes still pending. |
|
It seems that the author is not available. It would be a good improvement. |
|
I'd like to try, but not sure what is the best way to do it. Should I create a new PR or how it's possible to continue with the current? |
|
Yes. Create new one and merge commits from this one into it. |
|
Closed in favor of #192 |
Basic implementation of aws SQS. So far implements 2 authentication methods
Directly embedding key/secret in config
if key and secret is not preset it will use Default CredensialProvider
see http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/credentials.html#credential-profiles.
Please review and provide feedback.