View Javadoc

1   /*
2    * $Id: Callable.java 11129 2008-02-29 15:13:29Z acooke $
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.lifecycle;
12  
13  import org.mule.api.MuleEventContext;
14  
15  /**
16   * <code>Callable</code> is used to provide UMOs with an interface that supports
17   * event calls. UMO components do not have to implement this interface, though the
18   * <code>onCall</code> method provides an example lifecycle method that is executed
19   * when an event is received for the implementing service.
20   */
21  public interface Callable extends EventListener
22  {
23  
24      /**
25       * Passes the event to the listener
26       * 
27       * @param eventContext the context of the current event being process
28       * @return Object this object can be anything. When the
29       *         <code>LifecycleAdapter</code> for the service receives this
30       *         object it will first see if the Object is an <code>MuleMessage</code>
31       *         if not and the Object is not null a new message will be created using
32       *         the returned object as the payload. This new event will then get
33       *         published via the configured outbound router if-
34       *         <ol>
35       *         <li>One has been configured for the UMO.</li>
36       *         <li>the <code>setStopFurtherProcessing(true)</code> wasn't called
37       *         on the event context event.</li>
38       *         </ol>
39       * @throws Exception if the event fails to process properly. If exceptions aren't
40       *             handled by the implementation they will be handled by the
41       *             exceptionListener associated with the service
42       */
43      Object onCall(MuleEventContext eventContext) throws Exception;
44  
45  }