You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to support queue interaction from multiple aws regions.
If I were to implement this and contribute back - is that something the project would be interested in?
If so, in broad strokes, do you have a preference for how to do this: changing existing sqs package to support multi region, or a new one specifically for multi region?
We came to need to use a the multi region client because fifo queues are only available in some regions - when we first needed a fifo queue, there were not available in the same region as the rest of our queues. https://aws.amazon.com/sqs/faqs/#service-access-regions
Example usage:
$sdk = new Aws\Sdk([
'Sqs' => [
'region' => 'us-east-1',
'version' => '2012-11-05',
'credentials' => [
'key' => env('SQS_KEY'),
'secret' => env('SQS_SECRET'),
],
],
]);
/** @var \Aws\Sqs\SqsClient $sqsClient */
$sqsClient = $sdk->createSqs();
// $sqsClient can only make queries to queues in 'us-east-1' region
/** @var \Aws\MultiRegionClient $sqsMultiRegionClient */
$sqsMultiRegionClient = $sdk->createMultiRegionSqs();
// $sqsMultiRegionClient needs an '@region' key in each calls input args
$sqsClient->createQueueAsync([
'QueueName' => 'email-onboarding.fifo',
'Attributes' => [
'FifoQueue' => 'true',
],
]);
$sqsMultiRegionClient->createQueueAsync([
'@region' => 'us-east-2',
'QueueName' => 'email-onboarding.fifo',
'Attributes' => [
'FifoQueue' => 'true',
],
]);
For all the calls the enqueue would need to make, everything is the same + the addition of the region to each sqs api call
My preference would be for enqueue/sqs to only support the multi region sqs client - since it works fine for single and multi region uses and would provide the most flexibility moving forward.
I think the only place publicly exposing the client implementation is SqsContext::getClient - but could cause problems for anyone who has extended any of these methods which all internally call SqsContext::getClient:
Aws\MultiRegionClient does not publicly expose the method to get individual clients from its pool (1 client per region you attempt to perform an operation on)
Activity
makasim commentedon May 9, 2018
Hi,
Sorry, I am not sure I have enough knowledge. Could you please post a link to something regarding the topic or tell more about it?
Lidbetter commentedon May 9, 2018
This references the S3 client, but the same conventions apply to sqs calls
https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/s3-multiregion-client.html
We came to need to use a the multi region client because fifo queues are only available in some regions - when we first needed a fifo queue, there were not available in the same region as the rest of our queues.
https://aws.amazon.com/sqs/faqs/#service-access-regions
Example usage:
For all the calls the enqueue would need to make, everything is the same + the addition of the region to each sqs api call
My preference would be for
enqueue/sqsto only support the multi region sqs client - since it works fine for single and multi region uses and would provide the most flexibility moving forward.I think the only place publicly exposing the client implementation is
SqsContext::getClient- but could cause problems for anyone who has extended any of these methods which all internally callSqsContext::getClient:Aws\MultiRegionClientdoes not publicly expose the method to get individual clients from its pool (1 client per region you attempt to perform an operation on)makasim commentedon Dec 18, 2018
supported since 0.9.3