Access Keys:
Skip to content (Access Key - 0)
Cancel    
Cancel   

Contents

Error Handling Reuse

Design closed

Currently there's no way to reuse exception strategies as in Services. For Mule 3.3 we want users to be able to reuse exception strategy configuration.

Allowing users to reuse exception strategy configurations improves usability by saving them time and making their configuration files more readable. As a plus if exception strategies can be reused then this promotes their reuse by different people and different projects.

Enhancements to promote reusability:

  1. Redefine default exception strategy (used by all flows with no explicit exception strategy)
  2. Define global exception strategies that can be referenced later from flows

Redefine default exception strategy

JIRA Issue

MULE-5895

Provide users ability to redefine default exception strategy for every flow / service.
By default, each flow/service use a DefaultMessagingExceptionStrategy by default (this is equivalent to configuring an empty <default-exception-strategy> element). The <model> element used with <service>'s allows the user to define a different default exception strategy for all services contained within the model, but no such mechanism is available for Flows.

It should be possible to redefine the default exception strategy for every flow / service just by doing:

Proposed configuration style 1

Proposed configuration style 2

Proposed configuration style 3

This last configuration style make use of global exception strategy definitions.

After adding this configuration default exception strategy for flows and services will consume inbound message after successfully routing it to a dead letter queue.

Migration Impact

This is new functionality so there is no migration impact. One thing to note is that default exception strategies for services configured at the model level will continue to work, and will override any global default exception strategy configured. At the same time exception strategy configured at service or flow level will override any other exception strategy.

Acceptance Criteria

  1. Must be able to redefine default exception strategy for flows and services in a single place.
  2. If there's a global exception strategy configured and no other exception strategy configured then flows / services must use that exception strategy.
    When:
    Then:
    • flow A uses exception strategy defined in global-exception-strategy
    • service B uses exception strategy defined in global-exception-strategy
  3. If there's a global exception strategy configured, an exception strategy configured for a model then services within that model must use exception strategy configured in the model.
    When:
    Then:
    • flow A uses exception strategy defined within it
    • service B uses exception strategy defined within it
  4. If there's a global exception strategy configured, an exception strategy configured in a model and a service with a configured exception strategy within that model, then for that service the exception strategy to use must be the one defined in the service.
    When:
    Then:
    • flow A uses exception strategy defined within it
    • flow B uses global exception strategy
    • service C uses exception strategy defined within it
    • service D uses exception strategy defined within model

Define global exception strategies that can be referenced later from flows

JIRA Issue

MULE-5896

Provide users ability to define global exception strategy that can be reused later by other flows just by having a reference to them. It should be possible to reuse predefined exception strategies just by adding a reference to them from flows / services:

After adding this configuration several flows / services can reuse consumeMessage exception strategy and rollbackMessageAndNotify exception strategy by using <exception-strategy> element.

Acceptance Criteria

  1. Must be able to define several named exception strategies.
  2. Must be able to reference a named exception strategy from a flow / service.
    When:
    Then:
    • flow A uses exception strategy consumeMessage
    • flow B uses exception strategy rollbackMessageAndNotify
    • service C uses exception strategy consumeMessage

Documentation

Exception strategy reuse documentation