Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MessageReceiver |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
3 | * The software in this package is published under the terms of the CPAL v1.0 | |
4 | * license, a copy of which has been included with this distribution in the | |
5 | * LICENSE.txt file. | |
6 | */ | |
7 | package org.mule.api.transport; | |
8 | ||
9 | import org.mule.api.MuleEvent; | |
10 | import org.mule.api.MuleException; | |
11 | import org.mule.api.MuleMessage; | |
12 | import org.mule.api.construct.FlowConstruct; | |
13 | import org.mule.api.endpoint.EndpointURI; | |
14 | import org.mule.api.endpoint.ImmutableEndpoint; | |
15 | import org.mule.api.endpoint.InboundEndpoint; | |
16 | import org.mule.api.source.MessageSource; | |
17 | import org.mule.api.transaction.Transaction; | |
18 | ||
19 | import java.io.OutputStream; | |
20 | ||
21 | /** | |
22 | * <code>MessageReceiver</code> is used to receive data from an external system. | |
23 | * Typically an implementation of this interface will also implement the listener | |
24 | * interface for the external system. For example to listen to a JMS destination the | |
25 | * developer would also implement javax.jms.MessageListener. The endpoint (which | |
26 | * creates the MessageReceiver) will then register the receiver with the JMS | |
27 | * server. Where a listener interface is not availiable the derived | |
28 | * <code>MessageReceiver</code> will implement the code necessary to receive | |
29 | * data from the external system. For example, the file endpoint will poll a | |
30 | * specified directory for its data. | |
31 | */ | |
32 | public interface MessageReceiver extends Connectable, MessageSource | |
33 | { | |
34 | /** | |
35 | * @return the endpoint from which we are receiving events | |
36 | */ | |
37 | InboundEndpoint getEndpoint(); | |
38 | ||
39 | /** | |
40 | * @return the service associated with the receiver | |
41 | */ | |
42 | FlowConstruct getFlowConstruct(); | |
43 | ||
44 | /** | |
45 | * @param endpoint the endpoint to listen on | |
46 | * @see ImmutableEndpoint | |
47 | */ | |
48 | void setEndpoint(InboundEndpoint endpoint); | |
49 | ||
50 | /** | |
51 | * The endpointUri that this receiver listens on | |
52 | */ | |
53 | EndpointURI getEndpointURI(); | |
54 | ||
55 | String getReceiverKey(); | |
56 | ||
57 | void setReceiverKey(String key); | |
58 | ||
59 | MuleEvent routeMessage(MuleMessage message) throws MuleException; | |
60 | ||
61 | MuleEvent routeMessage(MuleMessage message, Transaction trans) throws MuleException; | |
62 | ||
63 | MuleEvent routeMessage(MuleMessage message, Transaction trans, OutputStream outputStream) | |
64 | throws MuleException; | |
65 | ||
66 | MuleMessage createMuleMessage(Object transportMessage, String encoding) throws MuleException; | |
67 | ||
68 | MuleMessage createMuleMessage(Object transportMessage) throws MuleException; | |
69 | } |