ElixirRetry
ElixirRetry copied to clipboard
Retry on *any* exception, forever
We are consuming messages from Kafka using Broadway.
Since Broadway will always ack the message we need to handle retry ourselves.
If there is any error we want to retry indefinitely.
This is the code we have:
retry_while with: exponential_backoff(1000) |> cap(10_000) do
try do
raise "BOOM"
rescue
exception ->
report(exception, __STACKTRACE__)
{:cont, nil}
else
_ -> {:halt, nil}
end
end
I assume if I don't use Stream.take then it will retry forever?
Any additional thoughts on this approach?
Thanks!