This section explains the best practices to be followed when creating mediation sequences in the following scenarios.
...
Use Iterator mediator in association with Aggregate mediator.
Do not do any configuration after the Send mediator.
Do proper error handling to handle mediation errors as well as endpoint errors.
Use dollar context (i.e.
$ctx)
instead of using theget
property.Info This is because the
get
-property methods search even in Registry if the value is not available in the message context. Thus, it affects performance as Registry search is an expensive operation. However,$
ctx
only checks in the message context.Use appropriate intervals for tasks.
- Use the ForEach mediator only for message transformations. If you need to make back-end calls from each iteration, then use the iterate mediator.
Last mediator in a sequence
...
The Sequence mediator calls a Mediation Sequence saved in the Synapse configuration or the Registry with a unique name. The In, Out or Fault sequence of a proxy service, REST API or the Main sequence cannot be called via this mediator.
The correct usage of the ForEach mediator
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
The correct usage of the Clone mediator
When using a Clone mediator, use a Call mediator in the target sequence to bring the responses back into the In-Sequence. This continues the mediation since the Continuation Stack gets pushed into the Synapse Message Context via the handleMessage
method in the SynapseCallbackReceiver
class.
Otherwise, the Continuation Stack becomes empty in the Synapse Message Context if you do not use a Call mediator in the target sequence.