View Javadoc

1   /*
2    * $Id: MessageDispatching.java 10961 2008-02-22 19:01:02Z 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.MuleEvent;
14  import org.mule.api.MuleMessage;
15  
16  /**
17   * Define generic methods for dispatching events.
18   * The exact behaviour of the action is defined by the implementing class.
19   * 
20   * @see org.mule.api.endpoint.OutboundEndpoint
21   * @see org.mule.api.transport.MessageDispatcher
22   */
23  public interface MessageDispatching
24  {
25      long RECEIVE_WAIT_INDEFINITELY = 0;
26      long RECEIVE_NO_WAIT = -1;
27  
28      /**
29       * Dispatches an event from the endpoint to the external system
30       * 
31       * @param event The event to dispatch
32       * @throws DispatchException if the event fails to be dispatched
33       */
34      void dispatch(MuleEvent event) throws DispatchException;
35  
36      /**
37       * Sends an event from the endpoint to the external system
38       * 
39       * @param event The event to send
40       * @return event the response form the external system wrapped in a MuleEvent
41       * @throws DispatchException if the event fails to be dispatched
42       */
43      MuleMessage send(MuleEvent event) throws DispatchException;
44  
45  }