Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Simperfit wants to merge1 commit intosymfony:masterfromSimperfit:patch-8
Closed
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletionsmessenger.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1131,6 +1131,35 @@ during a request::
:class:`Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase`
or :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase`.

Amazon SQS
~~~~~~~~~~

.. versionadded:: 5.1

The Amazon SQS transport has been added in Symfony 5.1
Install it by running:

.. code-block:: terminal

$ composer require symfony/amazon-sqs-messenger

The ``SQS`` transport configuration looks like this:

.. code-block:: bash

# .env
MESSENGER_TRANSPORT_DSN=sqs://guest:guest@sqs.eu-west-3.amazonaws.com/test?region=eu-west-3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
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

tomcoonen reacted with thumbs up emoji
Copy link
Member

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

tomcoonen reacted with thumbs up emoji

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 byparse_url. So it would be good to add an example using the options.

Suggested change
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)%"

Copy link
Member

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 youhave 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.

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.

Copy link
Member

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



.. note::

By default, the transport will automatically create queue that are needed. That can be disabled.
Copy link
Contributor

@noniagriconomienoniagriconomieMar 10, 2020
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
By default, the transport will automatically createqueue that are needed.That can be disabled.
By default, the transport will automatically createqueues that are needed.This can be disabled using the "auto_setup" option configuration.

or

Suggested change
By default, the transport will automatically create queue thatare needed.That can be disabled.
By default, the transport will automatically create queue thatis needed.This can be disabled using the "auto_setup" option configuration.

Nyholm reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

First one is better.


The transport has a number of other options, including ways to configure
the exchange, queues binding keys and more. See the documentation on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
the exchange, queues binding keys and more. See the documentation on
the exchange, queues binding keys and more. See thecodedocumentation on

Nyholm reacted with thumbs up emoji
:class:`Symfony\\Component\\Messenger\\Transport\\AmazonSqs\\Connection`.

Copy link
Member

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:

OptionDescriptionDefault
endpointAbsolute URL to the SQS servicehttps://sqs.eu-west-1.amazonaws.com
regionName of the AWS region eu-west-1
queue_nameName of the queuemessages
accountidentifier of the AWS accountthe owner of the credentials
access_keyAWS access key
secret_keyAWS secret key
buffer_sizenumber of messages to prefetch9
wait_timelong polling duration in seconds20
poll_timeoutwait for new message duration in seconds0.1
visibility_timeoutamount of seconds the message won't be visiblequeue's configuration
auto_setupWhether 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 SQSby 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`.

Nyholm reacted with thumbs up emoji

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 :)


Serializing Messages
~~~~~~~~~~~~~~~~~~~~

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp