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