1 /* 2 * $Id: MessageDispatcher.java 10489 2008-01-23 17:53:38Z 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.lifecycle.Disposable; 14 15 /** 16 * Combine {@link MessageDispatching} with 17 * various lifecycle methods for the actual instances doing message sending. 18 */ 19 public interface MessageDispatcher extends Disposable, Connectable, MessageDispatching 20 { 21 22 /** 23 * This method can perform necessary state updates before any of the 24 * {@link MessageDispatching} methods are invoked. 25 * 26 * @see {@link MessageDispatcherFactory#activate(org.mule.api.endpoint.ImmutableEndpoint, MessageDispatcher)} 27 */ 28 void activate(); 29 30 /** 31 * After sending a message, the dispatcher can use this method e.g. to 32 * clean up its internal state (if it has any) or return pooled resources to 33 * whereever it got them during {@link #activate()}. 34 * 35 * @see {@link MessageDispatcherFactory#passivate(org.mule.api.endpoint.ImmutableEndpoint, MessageDispatcher)} 36 */ 37 void passivate(); 38 39 /** 40 * Determines whether this dispatcher can be reused after message sending. 41 * 42 * @return <code>true</code> if this dispatcher can be reused, 43 * <code>false</code> otherwise (for example when 44 * {@link Disposable#dispose()} has been called because an Exception was 45 * raised) 46 */ 47 boolean validate(); 48 49 /** 50 * Gets the connector for this dispatcher 51 * 52 * @return the connector for this dispatcher 53 */ 54 Connector getConnector(); 55 56 }