Skip to content

Refactor retries #772

Closed
Closed
@cdavernas

Description

@cdavernas

What would you like to be added?

Refactor retries

Why is this needed?

Retries are one of the many actions that could be undertaken when an error is caught.

The current retry (strategy) definition should IMO be referenced by an handler that undertakes a retry upon given kinds of error (or upon all errors, possibly except some). It actually mixes both the handler and the retry concerns, and as such limit possibilities that we could open with my proposal.

What is your proposal?

Create a new errorHandler definition, that would allow users to define the errors they want to catch (or not to catch) and how they want to react (or not to react) to them.

An errorHandler could look like the following:

name: on-503
catch:
  when: 
    #type: https://fake.hotel.com/errors/bookings/failed
    status: 503
    # title: NotAvailable
    # condition: ${ jqexpression }
  #whenNot:
  #...
then:
  continue: true #continue the flow as if nothing happened
  #retry:
  #  policy: my-retry-policy
  # end: true
  # compensate: true

An action could then reference it like so:

actions:
  - name: my-action 
    functionRef: my-first-action
    onError:
      - on-503

Metadata

Metadata

Assignees

Labels

area: specChanges in the Specificationchange: featureNew feature or request. Impacts in a minor version change

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions