View Javadoc

1   /*
2    * $Id: InterfaceBinding.java 19547 2010-09-10 12:22:31Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.component;
12  
13  import org.mule.api.MessagingException;
14  import org.mule.api.MuleEvent;
15  import org.mule.api.MuleException;
16  import org.mule.api.endpoint.ImmutableEndpoint;
17  import org.mule.api.processor.MessageProcessor;
18  
19  public interface InterfaceBinding extends MessageProcessor
20  {
21  
22      /**
23       * This method is responsible for routing the Message via the MuleSession. The logic
24       * for this method will change for each type of router depending on expected
25       * behaviour. For example, a MulticastingRouter might just iterate through the
26       * list of assoaciated endpoints sending the message. Another type of router such
27       * as the ExceptionBasedRouter will hit the first endpoint, if it fails try the
28       * second, and so on. Most router implementations will extends the
29       * FilteringOutboundRouter which implements all the common logic need for a
30       * router.
31       *
32       * @param message the message to send via one or more endpoints on this router
33       * @param session the session used to actually send the event
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       * @throws MuleException 
38       * @see org.mule.routing.outbound.FilteringOutboundRouter
39       * @see org.mule.routing.outbound.ExceptionBasedRouter
40       * @see org.mule.routing.outbound.MulticastingRouter
41       *
42       * @since 2.1 the synchronous argument has been removed. Instead use the synchronous attribute of the endpoint
43       * you are dispatching to.
44       */
45      MuleEvent process(MuleEvent event) throws MuleException;
46  
47      void setEndpoint(ImmutableEndpoint endpoint) throws MuleException;
48      
49      ImmutableEndpoint getEndpoint();
50  
51      Class<?> getInterface();
52  
53      void setInterface(Class<?> interfaceClass);
54  
55      String getMethod();
56  
57      void setMethod(String method);
58  
59      /**
60       * This wires the dynamic proxy to the service object.
61       *
62       * @param target
63       */
64      Object createProxy(Object target);
65  }