Description
Description
Several users have requested the ability to "retry" invocations, but I think that retrying is made more difficult by the 1:* relationship functions have to topics.
Conceptual diagram of invocations
Use-case
As a developer using the connector-sdk, I want to be able to retry invocations that failed
1:1 mapping
If a message comes in on a topic payment
, and only one function stripe-fn
has a matching annotation of: topic: payment
.
In the case of a failure, the connector could just retry. This would probably be OK, depending on the function, perhaps some caution should be applied here.
The Linkerd2 documentation talks about the dangers of retrying automatically and about retry budgets. See: "How Retries can Go wrong" https://linkerd.io/2/features/retries-and-timeouts/
1:* mapping
This is the assumed default operating mode.
If a message comes in on a topic payment
, and two functions exist:stripe-fn
and datalake-fn
both with: topic: payment
.
In the case that datalake-fn
fails and stripe-fn
passes, following the logic above, retrying the whole batch may issue a second payment via stripe-fn
.
The proposed solution in #26 would act this way.
Potential solutions
-
[Feature Request] Include contextual information in responses #26 proposes that any response should indicate whether to acknowledge, delete, or do something else with a message. This works for a
1:1
mapping, but fails for a1:*
mapping. -
Have the status of all the invocations returned as a batch
The Invoke
method which is called by all connectors, when they receive messages could be extended to return a set of results. By returning a set of results the caller has to wait for N*max_timeout to decide whether a set of invocations were successful or not. This may be offset by using a Go channel, but the connector may still have to wait for all of the results to come in before making a decision.
This is what 2) would look like with the example in the connector-sdk GitHub repo:
Before:
After:
I would welcome input from anyone who is considering conditional acking, retrying or doing anything else with the results from the invocations.