View Javadoc

1   /*
2    * $Id: NestedRouter.java 10961 2008-02-22 19:01:02Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.api.routing;
12  
13  import org.mule.api.MessagingException;
14  import org.mule.api.MuleMessage;
15  import org.mule.api.MuleSession;
16  import org.mule.api.endpoint.OutboundEndpoint;
17  
18  public interface NestedRouter extends Router
19  {
20  
21      /**
22       * This method is responsible for routing the Message via the MuleSession. The logic
23       * for this method will change for each type of router depending on expected
24       * behaviour. For example, a MulticastingRouter might just iterate through the
25       * list of assoaciated endpoints sending the message. Another type of router such
26       * as the ExceptionBasedRouter will hit the first endpoint, if it fails try the
27       * second, and so on. Most router implementations will extends the
28       * FilteringOutboundRouter which implements all the common logic need for a
29       * router.
30       *
31       * @param message the message to send via one or more endpoints on this router
32       * @param session the session used to actually send the event
33       * @param synchronous whether the invocation process should be synchronous or not
34       * @return a result message if any from the invocation. If the synchronous flag
35       *         is false a null result will always be returned.
36       * @throws MessagingException if any errors occur during the sending of messages
37       * @see org.mule.routing.outbound.FilteringOutboundRouter
38       * @see org.mule.routing.outbound.ExceptionBasedRouter
39       * @see org.mule.routing.outbound.MulticastingRouter
40       */
41      MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws MessagingException;
42  
43      void setEndpoint(OutboundEndpoint endpoint);
44      
45      OutboundEndpoint getEndpoint();
46  
47      Class getInterface();
48  
49      void setInterface(Class interfaceClass);
50  
51      String getMethod();
52  
53      void setMethod(String method);
54  
55      /**
56       * This wires the dynamic proxy to the service object.
57       *
58       * @param target
59       */
60      Object createProxy(Object target);
61  }