1 /* 2 * $Id: UMOMessageReceiver.java 7963 2007-08-21 08:53:15Z 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.provider; 12 13 import org.mule.umo.UMOComponent; 14 import org.mule.umo.UMOException; 15 import org.mule.umo.UMOMessage; 16 import org.mule.umo.UMOTransaction; 17 import org.mule.umo.endpoint.UMOEndpoint; 18 import org.mule.umo.endpoint.UMOEndpointURI; 19 import org.mule.umo.lifecycle.Lifecycle; 20 21 import java.io.OutputStream; 22 23 /** 24 * <code>UMOMessageReceiver</code> is used to receive data from an external system. 25 * Typically an implementation of this interface will also implement the listener 26 * interface for the external system. For example to listen to a JMS destination the 27 * developer would also implement javax.jms.MessageListener. The endpoint (which 28 * creates the UMOMessageReceiver) will then register the receiver with the JMS 29 * server. Where a listener interface is not availiable the derived 30 * <code>UMOMessageReceiver</code> will implement the code necessary to receive 31 * data from the external system. For example, the file endpoint will poll a 32 * specified directory for its data. 33 */ 34 public interface UMOMessageReceiver extends Lifecycle, UMOConnectable 35 { 36 /** 37 * @return the receivers endpoint 38 */ 39 UMOEndpoint getEndpoint(); 40 41 /** 42 * @param message 43 * @param exception 44 */ 45 // void handleException(Object message, Throwable exception); 46 /** 47 * @return the component associated with the receiver 48 */ 49 UMOComponent getComponent(); 50 51 /** 52 * @param endpoint the endpoint to listen on 53 * @see UMOEndpoint 54 */ 55 void setEndpoint(UMOEndpoint endpoint); 56 57 /** 58 * @param component the component to associate with the receiver. When data is 59 * received the component <code>dispatchEvent</code> or 60 * <code>sendEvent</code> is used to dispatch the data to the 61 * relivant UMO. 62 */ 63 void setComponent(UMOComponent component); 64 65 void setConnector(UMOConnector connector); 66 67 UMOConnector getConnector(); 68 69 /** 70 * The endpointUri that this receiver listens on 71 * 72 * @return 73 */ 74 UMOEndpointURI getEndpointURI(); 75 76 String getReceiverKey(); 77 78 void setReceiverKey(String key); 79 80 UMOMessage routeMessage(UMOMessage message) throws UMOException; 81 82 UMOMessage routeMessage(UMOMessage message, boolean synchronous) throws UMOException; 83 84 UMOMessage routeMessage(UMOMessage message, UMOTransaction trans, boolean synchronous) 85 throws UMOException; 86 87 UMOMessage routeMessage(UMOMessage message, OutputStream outputStream) throws UMOException; 88 89 UMOMessage routeMessage(UMOMessage message, boolean synchronous, OutputStream outputStream) 90 throws UMOException; 91 92 UMOMessage routeMessage(UMOMessage message, 93 UMOTransaction trans, 94 boolean synchronous, 95 OutputStream outputStream) throws UMOException; 96 97 }