public class RouterMediator
extends org.apache.synapse.mediators.AbstractMediator
implements org.apache.synapse.ManagedLifecycle
Routes the messages going through this mediator in to the specified target sequecne or to the
taregt endpoint if the specified conditions under a particular route is matching. There can be
several routes and one can specify to break after the first matching route using the
breakRouter
attirbute in the routes and hence the route order has some impact on the
routings
Normally message routing is redirecting the message, so this mediator also permits further
mediation in this path where as the message is mediated using the roted path(s) by default, but
it can be configured by the continueAfter
attribute if required to continue further
mediation of the path
Individual routes are stored as Route
objects keeping there conditions inside it
with the routing targets as Target
objects inside a particualr route and there is a
linked list of
Route
per mediator.
Route
,
Target
,
Mediator
,
AbstractMediator
Constructor and Description |
---|
RouterMediator() |
Modifier and Type | Method and Description |
---|---|
void |
addRoute(Route route) |
void |
destroy()
called when Router is destroyed
|
List<Route> |
getRoutes() |
void |
init(org.apache.synapse.core.SynapseEnvironment synapseEnvironment)
called on Router startup.
|
boolean |
isContinueAfter() |
boolean |
mediate(org.apache.synapse.MessageContext synCtx)
Routes the message depending on the specified set of routes if the routing condition is
matching over the provided message.
|
void |
setContinueAfter(boolean continueAfter) |
void |
setRoutes(List<Route> routes) |
auditLog, auditWarn, configure, disableStatistics, disableTracing, divertMediationRoute, enableStatistics, enableTracing, getAspectConfiguration, getCommentsList, getDescription, getInputType, getLastSequenceFaultHandler, getLog, getMediatorName, getMediatorPosition, getOutputType, getRegisteredMediationFlowPoint, getShortDescription, getTraceState, getType, handleException, handleException, isBreakPoint, isContentAltering, isContentAware, isSkipEnabled, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, isTracingEnabled, registerMediationFlowPoint, reportCloseStatistics, reportOpenStatistics, setBreakPoint, setCommentsList, setComponentStatisticsId, setDescription, setEffectiveTraceState, setMediatorPosition, setShortDescription, setSkipEnabled, setTraceState, shouldCaptureTracing, shouldTrace, shouldTrace, traceOrDebug, traceOrDebugWarn, unregisterMediationFlowPoint
public boolean mediate(org.apache.synapse.MessageContext synCtx)
Routes the message depending on the specified set of routes if the routing condition is matching over the provided message. There can be a list of routers specified in to a particualr order, and these routes will be invoked to route the message in the specified order.
If there is a matching route found over the message then the routing will occur and after
this synchronized routing further mediation of the message through other routes specified
after the matching route will be decided by the value of the breakRouter
attribute of the route.
By default this mediator will drop the message stopping further medaition along the
current path and this also can be modified by using the continueAfter
attribute
of the mediator.
mediate
in interface org.apache.synapse.Mediator
synCtx
- message to be routedMediator.mediate(org.apache.synapse.MessageContext)
,
Route.doRoute(org.apache.synapse.MessageContext, SynapseLog)
public void addRoute(Route route)
public boolean isContinueAfter()
public void setContinueAfter(boolean continueAfter)
public void init(org.apache.synapse.core.SynapseEnvironment synapseEnvironment)
init
in interface org.apache.synapse.ManagedLifecycle
synapseEnvironment
- public void destroy()
destroy
in interface org.apache.synapse.ManagedLifecycle
Copyright © 2019 WSO2. All rights reserved.