Coverage Report - org.mule.api.transport.MessageDispatcher
 
Classes in this File Line Coverage Branch Coverage Complexity
MessageDispatcher
N/A
N/A
1
 
 1  
 /*
 2  
  * $Id: MessageDispatcher.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.OutboundEndpoint;
 16  
 import org.mule.api.lifecycle.Disposable;
 17  
 import org.mule.api.lifecycle.LifecycleStateEnabled;
 18  
 import org.mule.api.processor.MessageProcessor;
 19  
 
 20  
 /**
 21  
  * Combine {@link MessageDispatching} with
 22  
  * various lifecycle methods for the actual instances doing message sending.
 23  
  */
 24  
 public interface MessageDispatcher extends Connectable, MessageProcessor, LifecycleStateEnabled
 25  
 {
 26  
     long RECEIVE_WAIT_INDEFINITELY = 0;
 27  
     long RECEIVE_NO_WAIT = -1;
 28  
 
 29  
     /**
 30  
      * This method can perform necessary state updates before any of the
 31  
      * {@link MessageDispatching} methods are invoked.
 32  
      * 
 33  
      * @see MessageDispatcherFactory#activate(OutboundEndpoint, MessageDispatcher)
 34  
      */
 35  
     void activate();
 36  
 
 37  
     /**
 38  
      * After sending a message, the dispatcher can use this method e.g. to
 39  
      * clean up its internal state (if it has any) or return pooled resources to
 40  
      * whereever it got them during {@link #activate()}.
 41  
      * 
 42  
      * @see MessageDispatcherFactory#passivate(OutboundEndpoint, MessageDispatcher)
 43  
      */
 44  
     void passivate();
 45  
 
 46  
     /**
 47  
      * Determines whether this dispatcher can be reused after message sending.
 48  
      * 
 49  
      * @return <code>true</code> if this dispatcher can be reused,
 50  
      *         <code>false</code> otherwise (for example when
 51  
      *         {@link Disposable#dispose()} has been called because an Exception was
 52  
      *         raised)
 53  
      */
 54  
     boolean validate();
 55  
 
 56  
     /**
 57  
      * Gets the connector for this dispatcher
 58  
      * 
 59  
      * @return the connector for this dispatcher
 60  
      */
 61  
     Connector getConnector();
 62  
 
 63  
     /**
 64  
      * @return the endpoint which we are dispatching events to
 65  
      */
 66  
     OutboundEndpoint getEndpoint();
 67  
     
 68  
     MuleMessage createMuleMessage(Object transportMessage, String encoding) throws MuleException;
 69  
 
 70  
     MuleMessage createMuleMessage(Object transportMessage) throws MuleException;
 71  
 }