Dynamic Retry Mechanism

We are designing a solution that requires pulling data from an external API. The process can be intensive and might hit some rate limits on the external API.
I would like to use the Retry-After returned by these APIs but the current retry policy implementation does not support setting dynamic retries based on the activity output.

Utilizing workflow.Sleep is also not permitted as it will require running the activity agin and will cause a non deterministic behavior (if i’m not mistaken).

I don’t want to time.Sleep from my activity, is there a better solution for this issue?

Thanks

I would like to use the Retry-After returned by these APIs

you can from activity return NewApplicationErrorWithOptions and specify delay based on retry-after returned by your api, for example:

return temporal.NewApplicationErrorWithOptions("Error with retry-after delay", "RetryAfterDelay", temporal.ApplicationErrorOptions{
   NextRetryDelay: delay,
})

@tihomir
Exactly what I needed!
Thanks, much appreciate!