-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
feat: add amazon sqs to docs #13328
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
feat: add amazon sqs to docs #13328
Conversation
By default, the transport will automatically create queue that are needed. That can be disabled. | ||
|
||
The transport has a number of other options, including ways to configure | ||
the exchange, queues binding keys and more. See the documentation on |
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 exchange, queues binding keys and more. See the documentation on | |
the exchange, queues binding keys and more. See the code documentation on |
|
||
.. note:: | ||
|
||
By default, the transport will automatically create queue that are needed. That can be disabled. |
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 default, the transport will automatically create queue that are needed. That can be disabled. | |
By default, the transport will automatically create queues that are needed. This can be disabled using the "auto_setup" option configuration. |
or
By default, the transport will automatically create queue that are needed. That can be disabled. | |
By default, the transport will automatically create queue that is needed. This can be disabled using the "auto_setup" option configuration. |
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.
First one is better.
.. code-block:: bash | ||
|
||
# .env | ||
MESSENGER_TRANSPORT_DSN=sqs://guest:guest@sqs.eu-west-3.amazonaws.com/test?region=eu-west-3 |
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.
MESSENGER_TRANSPORT_DSN=sqs://guest:guest@sqs.eu-west-3.amazonaws.com/test?region=eu-west-3 | |
MESSENGER_TRANSPORT_DSN=sqs://AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY@sqs.eu-west-3.amazonaws.com/messages |
- use real world credential to help people understanding that credentials are AWS key/secret
- use a real world queue name
- remove option region as it's already resolved via the host
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 would also add an option to debug with local fake sqs
MESSENGER_TRANSPORT_DSN=sqs://localhost:9494/messages?sslmode=disable
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.
@jderusse Your example with slashes in the password won't work since it will be parsed by parse_url
. So it would be good to add an example using the options.
MESSENGER_TRANSPORT_DSN=sqs://guest:guest@sqs.eu-west-3.amazonaws.com/test?region=eu-west-3 | |
MESSENGER_TRANSPORT_DSN=sqs://sqs.eu-west-3.amazonaws.com/23982323/queue-name |
And add this in the example since at least a lot of AWS secrets have slashes in them:
messenger:
transports:
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
options:
access_key: "%env(AWS_KEY)%"
secret_key: "%env(AWS_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.
thanks.
specials char in credentials works but you have to urlencode theme.
indeed my exemple is buggy because of this.
I'd rather keep (and fix) my exemple and add a note about that in the doc. Many people are confused about this.
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.
A lot of AWS keys will have slashes in them, and I also don't like you have to put your AWS credentials in the .env file multiple times since it's in the DSN in the example.
At least mention this in docs so people don't have to find this out.
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.
Agreed. Both ways should be documented.
I like your sample. A little bit more verbose, but avoid missconfiguraiton.
But url_encoding credential is hard to find in the current documentation and should also be documented
The transport has a number of other options, including ways to configure | ||
the exchange, queues binding keys and more. See the documentation on | ||
:class:`Symfony\\Component\\Messenger\\Transport\\AmazonSqs\\Connection`. | ||
|
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 would define the list of options:
Option | Description | Default |
---|---|---|
endpoint | Absolute URL to the SQS service | https://sqs.eu-west-1.amazonaws.com |
region | Name of the AWS region | eu-west-1 |
queue_name | Name of the queue | messages |
account | identifier of the AWS account | the owner of the credentials |
access_key | AWS access key | |
secret_key | AWS secret key | |
buffer_size | number of messages to prefetch | 9 |
wait_time | long polling duration in seconds | 20 |
poll_timeout | wait for new message duration in seconds | 0.1 |
visibility_timeout | amount of seconds the message won't be visible | queue's configuration |
auto_setup | Whether the table should be created automatically during send / get. | true |
and add the note:
difference between `wait_time` and `poll_timeout`: The `wait_time` parameter define
the maximum duration Amazon SQS should wait until a message is available in a
queue before sending a response. It helps reducing the cost of using Amazon SQS
by eliminating the number of empty responses.
The `poll_timeout` parameter define the duration the receiver should wait before
returning null. It avoids blocking other receivers from being called
and also add:
If the queue name is suffixed by `.fifo` AWS will creates a
[FIFO queue](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html).
Use the stamp `Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsFifoStamp`
to define the `Message group ID` and the `Message deduplication ID`.
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.
another note:
FIFO queues don't support setting a delay per message, for retries to work you need set this to 0 in the config.
retry_strategy:
delay: 0 # FIFO queues don't support per-message delay settings
I actually don't know if this should be in the docs or it is a bug :)
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.
Thank you @Simperfit could you please update the PR according to the comments?
Sure. |
I added a PR here: #14391 |
This fix #13093 and add a begin documentation on how to use the amazon sqs transport.
Tell me if you want more information I guess this is enough and it works properly like this.