Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] Reproduce messages to different transport for retrying #34235

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

Closed
TiMESPLiNTER opened this issue Nov 5, 2019 · 8 comments
Closed

Comments

@TiMESPLiNTER
Copy link

TiMESPLiNTER commented Nov 5, 2019

Description

Currently if an exception occurs during handling a message and there are retries defined for the transport it will get resent to the same transport it came from. It would be great to define the transport to which the message should be reproduced in case of failure.

Example

framework:
    messenger:
        transports:
            async_priority_high:
                retry_strategy:
                    transport: my_retry_transport
@Tobion
Copy link
Contributor

Tobion commented Nov 5, 2019

This is very easy to achieve since #34185. You just need to inject a different ContainerInterface $sendersLocator in SendFailedMessageForRetryListener that returns the retry transport you want for the given transport the message come from.

@Tobion
Copy link
Contributor

Tobion commented Nov 5, 2019

Making this configurable might make sense. What's the use-case?

@TiMESPLiNTER
Copy link
Author

TiMESPLiNTER commented Nov 6, 2019

Making this configurable might make sense. What's the use-case?

The use case is that I consume from a kafka topic and might have to retry the message due to other messages still missing before I can process that very message. So a retry is needed. As Kafka is write-ahead it doesn't make sense to produce the message to the same kafka topic again as this can screw things up in an event stream. Therefor I would need to store the messages to retry somewhere else than in the original kafka topic.

Unfortunately I'm currently tied to version 4.3 so I can't use the latest 4.4.x-dev branch of symfony messenger. Any other workaround which works for 4.3 as well?

@alsar
Copy link

alsar commented Nov 6, 2019

Making this configurable might make sense. What's the use-case?

Another use case is when you use a queue (like Kafka) that doesn't support delaying of messages. You want to send failed messages to another transport so you can try them again at a later point. To sent them back to Kafka doesn't make sense, because you will get the message back right away.

@Tobion
Copy link
Contributor

Tobion commented Feb 9, 2020

The use-cases listed can be solved with #34979. Instead of using different retry-transports, you just disable retry and use different failure-transports. This also seem more appropriate to me as retry is meant for automatic retry (which only makes sense on the same transport). Manual or semi-automated handling of failed messages is a different topic which is fits the failure logic better.

@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@carsonbot
Copy link

Hello? This issue is about to be closed if nobody replies.

@carsonbot
Copy link

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants