Closed josevalim closed 2 years ago
In case there are failures in a processor or batch processor, today we go ahead and process the next task, but it may be beneficial to do a back-off. I haven't really thought about the API on this though. But that's the general idea. :)
Hi! How could one possibly implement something like this in the current version? Would rate-limiting be the best alternative?
Thank you for a great library! :)
You can implement it today by sleeping the processor where the failure happened. Not ideal but does the trick. Rate limiting if possible would work better today, as that is built in.
I think implementation can be putting failed messages in separate queues in separate processes, according to number of retries / retry time, not blocking messages processing in processors / batchers. In the configuration it would have parameters like max_tries, max_time, backoff_algorithm, for processors and batchers
I am wondering what benefit the back-off feature can be provided. As what GenStage suggested:
Layers in GenStage must be created when there is a need for back-pressure or to route the data in different ways.
In Broadway, the messages are acked at the end of the pipeline. The processing in-between are mostly in-memory and in-process. When we normally use the back-off feature, we need to offload the message to another dead-letter queue or database temply, say for 1 second, 5 second or even longer.
The official Broadway RabbitMQ component already provides requeue feature. It seems the back-off should be applied on this level. If there is processing error in Broadway, what behavior back-off is expected to provide?
The back-off in this case is more about: oh, this external services fail from time to time, so let's automatically retry it but even then we may be bettter with a simple function based approach rather than something backed into Broadway, so overall I agree with you. Closing this then. :)
@josevalim can you expand on what this issue is about? :)