01: /*
02: * $Id: Callable.java 11129 2008-02-29 15:13:29Z acooke $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
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: * 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>LifecycleAdapter</code> for the service receives this
29: * object it will first see if the Object is an <code>MuleMessage</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 service
41: */
42: Object onCall(MuleEventContext eventContext) throws Exception;
43:
44: }
|