This section explains the best practices to be followed when creating mediation sequences in the following scenarios.
Last mediator in a sequence
The last mediator in a mediation sequence should be one of the following mediators depending on the scenario. Any mediator added after one of the following mediators will not be applied.
- Drop mediator: when you want to stop the mediation flow at a particular point (e.g., when a filter condition is not met).
- Loopback mediator: when you want the message to be moved from the In sequence to the Out sequence. Note that the Loopback mediator only prevents the subsequent mediators in the In sequence from being applied.
- Respond mediator: when you want the message to be sent back to the client.
- Send Mediator: when you want the message to be sent to the specified endpoint. If a message should be further mediated after it is sent, you can use the Clone mediator to make two copies of the message and process them separately, thereby avoiding conflicts.
Defining the In and Out sequences
The In and Out sequences are separately defined for proxy services and REST APIs. Therefore, In and Out mediators should not be used in proxy service and REST API configurations. However, they should be used in the main sequence.
The correct usage of the Loopback mediator
Once a message has been passed from the In sequence (request path) to the Out sequence (response path), it cannot be moved to the Out sequence again via the Loopback mediator.