-
Couldn't load subscription status.
- Fork 25
Improve SQS Transport Resolver to match standard configuration #98
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
|
I added some tests and refactor a class with an interface. |
|
Hi @mnapoli Could you please take a moment to review this PR when you have a chance? Thanks a lot in advance! Best, |
|
|
||
| use InvalidArgumentException; | ||
|
|
||
| interface SQSMessengerTransportConfigurationInterface |
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.
Is there a reason to introduce a new interface?
If there's no specific reason I'd rather keep the API surface as small as possible to facilitate maintenance
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 interface would have allowed me to implement these changes with less code overhead. It could still be used to implement a more complex strategy, such as changing the transport based on the message content or other parameters.
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.
OK thanks for the details, let's remove it until it's actually needed please
| private const TRANSPORT_PROTOCOL = 'sqs://'; | ||
|
|
||
| public function __construct( | ||
| private MessengerTransportConfiguration $configurationProvider |
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.
What happens to the existing class? I see it's no longer used in this PR.
- should we delete the class?
- are we preserving backwards compatibility with the current behavior?
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 MessengerTransportConfiguration class is still used by the SnsTransportNameResolver class for transport via SNS. It should be preserved.
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! what about the second question?
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.
In cases where the user did not use the queue URL or manually specified the transport name for processing the event, there will be no impact.
Previously, omitting the manual transport name and using only the SQS queue URL in the transport DSN would have raised an InvalidArgumentException.
Now, the transport matching the SQS queue that originated the event will be returned automatically. This change should only affect users who deliberately caused errors, which is unlikely to be a valid use case.
|
|
||
| use InvalidArgumentException; | ||
|
|
||
| final class SQSMessengerTransportConfiguration implements SQSMessengerTransportConfigurationInterface |
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 this new class is only ever used in SqsTransportNameResolver (as far as I can tell), can you inline the logic in SqsTransportNameResolver?
The bridge is already more complex than it should be, making it hard to review and merge improvements (like this PR) because it requires time to re-understand everything. I'd prefer we actually simplify it, even if it means we have larger classes.
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'm trying to do it during the day or tomorrow
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.
Done
|
Hi @mnapoli, Would you mind taking a final look at this PR when you get a moment? I've implemented all the requested changes, and I’d really appreciate your approval to get it merged. This will help me reduce the number of Lambdas used across my projects and consequently lower the security scan costs associated with their deployment. Let me know if anything else is needed! Thanks a lot in advance, Best, |
|
Thanks let's give this a try |
This PR updates the transport resolution logic to support SQS DSNs formatted according to the Symfony documentation (e.g., https://sqs.eu-west-3.amazonaws.com/123456789012/messages). This allows seamless configuration when using multiple SQS queues and transports.