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.MuleException; 10 import org.mule.api.MuleMessage; 11 import org.mule.api.endpoint.InboundEndpoint; 12 import org.mule.api.endpoint.OutboundEndpoint; 13 import org.mule.api.lifecycle.LifecycleStateEnabled; 14 15 16 /** 17 * Combine {@link org.mule.api.transport.MessageRequesting} with 18 * various lifecycle methods for the actual instances doing message sending. 19 */ 20 public interface MessageRequester extends Connectable, MessageRequesting, LifecycleStateEnabled 21 { 22 /** 23 * This method can perform necessary state updates before any of the 24 * {@link org.mule.api.transport.MessageDispatching} methods are invoked. 25 * 26 * @see MessageDispatcherFactory#activate(OutboundEndpoint, MessageDispatcher) 27 */ 28 void activate(); 29 30 /** 31 * After receiving 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 MessageDispatcherFactory#passivate(OutboundEndpoint, MessageDispatcher) 36 */ 37 void passivate(); 38 39 /** 40 * Determines whether this dispatcher can be reused after message receiving. 41 * 42 * @return <code>true</code> if this dispatcher can be reused, 43 * <code>false</code> otherwise (for example when 44 * {@link org.mule.api.lifecycle.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 /** 57 * @return the endpoint used for requesting events 58 */ 59 InboundEndpoint getEndpoint(); 60 61 MuleMessage createMuleMessage(Object transportMessage, String encoding) throws MuleException; 62 63 MuleMessage createMuleMessage(Object transportMessage) throws MuleException; 64 }