Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MessageReceiver |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: MessageReceiver.java 12269 2008-07-10 04:19:03Z dfeist $ | |
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.transport; | |
12 | ||
13 | import org.mule.api.MuleException; | |
14 | import org.mule.api.MuleMessage; | |
15 | import org.mule.api.endpoint.EndpointURI; | |
16 | import org.mule.api.endpoint.InboundEndpoint; | |
17 | import org.mule.api.lifecycle.Lifecycle; | |
18 | import org.mule.api.service.Service; | |
19 | import org.mule.api.transaction.Transaction; | |
20 | ||
21 | import java.io.OutputStream; | |
22 | ||
23 | /** | |
24 | * <code>MessageReceiver</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 MessageReceiver) will then register the receiver with the JMS | |
29 | * server. Where a listener interface is not availiable the derived | |
30 | * <code>MessageReceiver</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 MessageReceiver extends Lifecycle, Connectable | |
35 | { | |
36 | /** | |
37 | * @return the receivers endpoint | |
38 | */ | |
39 | InboundEndpoint getEndpoint(); | |
40 | ||
41 | /** | |
42 | * @param message | |
43 | * @param exception | |
44 | */ | |
45 | // void handleException(Object message, Throwable exception); | |
46 | /** | |
47 | * @return the service associated with the receiver | |
48 | */ | |
49 | Service getService(); | |
50 | ||
51 | /** | |
52 | * @param endpoint the endpoint to listen on | |
53 | * @see ImmutableEndpoint | |
54 | */ | |
55 | void setEndpoint(InboundEndpoint endpoint); | |
56 | ||
57 | /** | |
58 | * @param service the service to associate with the receiver. When data is | |
59 | * received the service <code>dispatchEvent</code> or | |
60 | * <code>sendEvent</code> is used to dispatch the data to the | |
61 | * relivant UMO. | |
62 | */ | |
63 | void setService(Service service); | |
64 | ||
65 | void setConnector(Connector connector); | |
66 | ||
67 | Connector getConnector(); | |
68 | ||
69 | /** | |
70 | * The endpointUri that this receiver listens on | |
71 | * | |
72 | * @return | |
73 | */ | |
74 | EndpointURI getEndpointURI(); | |
75 | ||
76 | String getReceiverKey(); | |
77 | ||
78 | void setReceiverKey(String key); | |
79 | ||
80 | MuleMessage routeMessage(MuleMessage message) throws MuleException; | |
81 | ||
82 | MuleMessage routeMessage(MuleMessage message, boolean synchronous) throws MuleException; | |
83 | ||
84 | MuleMessage routeMessage(MuleMessage message, Transaction trans, boolean synchronous) | |
85 | throws MuleException; | |
86 | ||
87 | MuleMessage routeMessage(MuleMessage message, OutputStream outputStream) throws MuleException; | |
88 | ||
89 | MuleMessage routeMessage(MuleMessage message, boolean synchronous, OutputStream outputStream) | |
90 | throws MuleException; | |
91 | ||
92 | MuleMessage routeMessage(MuleMessage message, | |
93 | Transaction trans, | |
94 | boolean synchronous, | |
95 | OutputStream outputStream) throws MuleException; | |
96 | ||
97 | } |