KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > umo > routing > UMOOutboundRouter


1 /*
2  * $Id: UMOOutboundRouter.java 3798 2006-11-04 04:07:14Z aperepel $
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 MuleSource MPL
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.routing;
12
13 import org.mule.umo.MessagingException;
14 import org.mule.umo.UMOMessage;
15 import org.mule.umo.UMOSession;
16 import org.mule.umo.UMOTransactionConfig;
17 import org.mule.umo.endpoint.UMOEndpoint;
18
19 import java.util.List JavaDoc;
20
21 /**
22  * <code>UMOOutboundRouter</code> is used to control outbound routing behaviour for
23  * an event. One or more Outbound routers can be associated with an
24  * <code>UMOOutboundMessageRouter</code> and will be selected based on the filters
25  * set on the individual Outbound Router.
26  *
27  * @see UMOOutboundMessageRouter
28  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
29  * @version $Revision: 3798 $
30  */

31
32 public interface UMOOutboundRouter extends UMORouter
33 {
34     /**
35      * Sets a list of UMOEndpoint instances associated with this router
36      *
37      * @param endpoints a list of UMOEndpoint instances
38      */

39     void setEndpoints(List JavaDoc endpoints);
40
41     /**
42      * Gets a list of UMOEndpoint instances associated with this router
43      *
44      * @return a list of UMOEndpoint instances
45      */

46     List JavaDoc getEndpoints();
47
48     /**
49      * Adds an endpoint to this router
50      *
51      * @param endpoint the endpoint to add to the router
52      */

53     void addEndpoint(UMOEndpoint endpoint);
54
55     /**
56      * Removes a specific endpoint from the router
57      *
58      * @param endpoint the endpoint to remove
59      * @return true if the endpoint was removed
60      */

61     boolean removeEndpoint(UMOEndpoint endpoint);
62
63     /**
64      * This method is responsible for routing the Message via the Session. The logic
65      * for this method will change for each type of router depending on expected
66      * behaviour. For example, a MulticastingRouter might just iterate through the
67      * list of assoaciated endpoints sending the message. Another type of router such
68      * as the ExceptionBasedRouter will hit the first endpoint, if it fails try the
69      * second, and so on. Most router implementations will extends the
70      * FilteringOutboundRouter which implements all the common logic need for a
71      * router.
72      *
73      * @param message the message to send via one or more endpoints on this router
74      * @param session the session used to actually send the event
75      * @param synchronous whether the invocation process should be synchronous or not
76      * @return a result message if any from the invocation. If the synchronous flag
77      * is false a null result will always be returned.
78      * @throws MessagingException if any errors occur during the sending of messages
79      * @see org.mule.routing.outbound.FilteringOutboundRouter
80      * @see org.mule.routing.outbound.ExceptionBasedRouter
81      * @see org.mule.routing.outbound.MulticastingRouter
82      */

83     UMOMessage route(UMOMessage message, UMOSession session, boolean synchronous) throws MessagingException;
84
85     /**
86      * Determines if the event should be processed by this router. Routers can be
87      * selectively invoked by configuring a filter on them. Usually the filter is
88      * applied to the message when calling this method. All core Mule outbound
89      * routers extend the FilteringOutboundRouter router that handles this method
90      * automatically.
91      *
92      * @param message the current message to evaluate
93      * @return true if the event should be processed by this router
94      * @throws MessagingException if the event cannot be evaluated
95      * @see org.mule.routing.inbound.SelectiveConsumer
96      */

97     boolean isMatch(UMOMessage message) throws MessagingException;
98
99     UMOTransactionConfig getTransactionConfig();
100
101     void setTransactionConfig(UMOTransactionConfig transactionConfig);
102
103     /**
104      * Gets the replyTo endpoint for any outgoing messages. This will then be used by
105      * other Mule routers to send replies back for this message. If the underlying
106      * protocol supports replyTo messages, such as Jms, a Jms Destination will be
107      * attached to the outbound message
108      *
109      * @return the replyTo endpoint or null if one has not been set.
110      */

111     public String JavaDoc getReplyTo();
112
113     /**
114      * Sets the replyTo endpoint for any outgoing messages. This will then be used by
115      * other Mule routers to send replies back for this message. If the underlying
116      * protocol supports replyTo messages, such as Jms, a Jms Destination will be
117      * attached to the outbound message
118      *
119      * @param replyTo endpoint string to use
120      */

121     public void setReplyTo(String JavaDoc replyTo);
122
123     /**
124      * Determines whether this router supports dynamic endpoint. i.e. endpoints that
125      * are not configured at design time. Endpoints might be pulled from the message
126      * or payload.
127      *
128      * @return
129      */

130     public boolean isDynamicEndpoints();
131
132 }
133
Popular Tags