Class Route


  • public class Route
    extends Object

    Specifies the Route including the route conditions and the routing of a particular route for the RouterMediator. This stores the properties of a particular route and will be used by the RouterMedaitor in order to route the messages.

    This stores the routing path as a Target whihc can contain either a sequence or else and endpoint as the routing path and in the endpoint case the message will be delivered to the specified endpoint

    See Also:
    RouterMediator, Target
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ROUTE_NOT_MACHING_STATE
      The state of the Route after calling the doRoute method is this particular route over the specified message does not match the conditions specified in this route.
      static int ROUTED_AND_DROPPED_STATE
      The state of the Route after calling the doRoute method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, at the same time the message must not go through any other matching routes within this router.
      static int ROUTED_WITH_BREAK_STATE
      The state of the Route after calling the doRoute method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, and the message should not go though any more routes within this router.
      static int ROUTED_WITH_CONTINUE_STATE
      The state of the Route after calling the doRoute method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, but the message may go through any other matching routes within this router for further routing.
      static int UNEXPECTED_ROUTING_STATE
      The state of the routing, when there is an error in routing after executing the doRoute method.
    • Constructor Summary

      Constructors 
      Constructor Description
      Route()  
    • Field Detail

      • ROUTED_WITH_BREAK_STATE

        public static final int ROUTED_WITH_BREAK_STATE

        The state of the Route after calling the doRoute method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, and the message should not go though any more routes within this router.

        See Also:
        doRoute(org.apache.synapse.MessageContext, SynapseLog), Constant Field Values
      • ROUTED_WITH_CONTINUE_STATE

        public static final int ROUTED_WITH_CONTINUE_STATE

        The state of the Route after calling the doRoute method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, but the message may go through any other matching routes within this router for further routing.

        See Also:
        doRoute(org.apache.synapse.MessageContext, SynapseLog), Constant Field Values
      • ROUTED_AND_DROPPED_STATE

        public static final int ROUTED_AND_DROPPED_STATE

        The state of the Route after calling the doRoute method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, at the same time the message must not go through any other matching routes within this router.

        See Also:
        doRoute(org.apache.synapse.MessageContext, SynapseLog), Constant Field Values
    • Constructor Detail

      • Route

        public Route()
    • Method Detail

      • isMatching

        public boolean isMatching​(org.apache.synapse.MessageContext synCtx,
                                  org.apache.synapse.SynapseLog synLog)

        Checks whether this route is matching for the given message or not. In general if the expression is provided without a match then the presence of a element or attribute in the message specified by the expression will be taken as matching

        If both the expression and the match is provided then the evaluated string value of the expression over the message will be matched againset the given regular expression match to test whether the string value is matching for the pattern or not

        Parameters:
        synCtx - message to be matched to check the route condition
        Returns:
        whether the route matches the given message or not
      • doRoute

        public int doRoute​(org.apache.synapse.MessageContext synCtx,
                           org.apache.synapse.SynapseLog synLog)

        Routes the message in to the specified target whihc can be one of the sequence or else and endpoint after checking whether the conditions specified in this route matches the provided message.

        Also if this particular router specifies the breakRouter to be false then the specified status will be returned to not to break the route and route further matchings in the router. Otherwise it will break the route

        Parameters:
        synCtx - message to be routed
        Returns:
        state of the routing and this can be one of the ROUTE_NOT_MACHING_STATE, or ROUTED_WITH_BREAK_STATE, or ROUTED_WITH_CONTINUE state.
        See Also:
        isMatching(org.apache.synapse.MessageContext, SynapseLog)
      • getMatch

        public Pattern getMatch()
      • setMatch

        public void setMatch​(Pattern match)
      • getExpression

        public org.apache.synapse.util.xpath.SynapseXPath getExpression()
      • setExpression

        public void setExpression​(org.apache.synapse.util.xpath.SynapseXPath expression)
      • isBreakRouter

        public boolean isBreakRouter()
      • setBreakRouter

        public void setBreakRouter​(boolean breakRouter)
      • getTarget

        public org.apache.synapse.mediators.eip.Target getTarget()
      • setTarget

        public void setTarget​(org.apache.synapse.mediators.eip.Target target)