confluentinc / parallel-consumer

Parallel Apache Kafka client wrapper with per message ACK, client side queueing, a simpler consumer/producer API with key concurrency and extendable non-blocking IO processing.

Home Page:https://confluent.io/confluent-accelerators/#parallel-consumer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom retry delay duration from supplier function

astubbs opened this issue · comments

Most flexible, pluggable retry delay system - user provides a function that generates a retry delay.

@radoslawtwardy how does this look? : master...astubbs:retry-delay-generator-func
It's a simple change. The other option I'd been thinking about, would be for the user function to throw a "retry exception" which will contain the retry delay as a field. The motivation for that solution is it gives the user ultimate context to generate the retry delay. Where as the retry delay function option only gives the user the WorkContainer as context.

I'm not sure how can I use it. To write custom function i must has some retry count context, or something like it. For example i want write simple algorithm:
2^retryNb [s]
How i can use WorkContainer to do it? Maybe i can get some previous, effective delay from it ?