View Javadoc

1   /*
2    * $Id: Callable.java 7976 2007-08-21 14:26:13Z dirk.olmes $
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.umo.lifecycle;
12  
13  import org.mule.umo.UMOEventContext;
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 component.
20   */
21  public interface Callable extends UMOEventListener
22  {
23      /**
24       * Passes the event to the listener
25       * 
26       * @param eventContext the context of the current event being process
27       * @return Object this object can be anything. When the
28       *         <code>UMOLifecycleAdapter</code> for the component receives this
29       *         object it will first see if the Object is an <code>UMOMessage</code>
30       *         if not and the Object is not null a new message will be created using
31       *         the returned object as the payload. This new event will then get
32       *         published via the configured outbound router if-
33       *         <ol>
34       *         <li>One has been configured for the UMO.</li>
35       *         <li>the <code>setStopFurtherProcessing(true)</code> wasn't called
36       *         on the event context event.</li>
37       *         </ol>
38       * @throws Exception if the event fails to process properly. If exceptions aren't
39       *             handled by the implementation they will be handled by the
40       *             exceptionListener associated with the component
41       */
42      Object onCall(UMOEventContext eventContext) throws Exception;
43  }