org.mule.api.transport
Interface MessageDispatcherFactory

All Known Implementing Classes:
AbstractMessageDispatcherFactory, AjaxMessageDispatcherFactory, AxisMessageDispatcherFactory, AxisWsdlMessageDispatcherFactory, EjbMessageDispatcherFactory, FileMessageDispatcherFactory, FtpMessageDispatcherFactory, HttpClientMessageDispatcherFactory, HttpsClientMessageDispatcherFactory, JdbcMessageDispatcherFactory, JmsMessageDispatcherFactory, KeyedPoolMessageDispatcherFactoryAdapter, LocalSocketTcpMessageDispatcherFactory, QuartzMessageDispatcherFactory, RmiMessageDispatcherFactory, SftpMessageDispatcherFactory, SmtpMessageDispatcherFactory, StdioMessageDispatcherFactory, TcpMessageDispatcherFactory, UdpMessageDispatcherFactory, UnsupportedMessageDispatcherFactory, VMMessageDispatcherFactory, XmppMessageDispatcherFactory

public interface MessageDispatcherFactory

MessageDispatcherFactory is a factory interface for managing the lifecycles of a transport's message dispatchers. The methods basically implement the KeyedPoolableObjectFactory lifecycle, with a ImmutableEndpoint as the key and the dispatcher as pooled object.


Method Summary
 void activate(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
          Invoked before the given dispatcher is handed out to a client, but not after create(OutboundEndpoint).
 MessageDispatcher create(OutboundEndpoint endpoint)
          Creates a new message dispatcher instance, initialised with the passed endpoint.
 void destroy(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
          Invoked when a dispatcher returned false for validate(OutboundEndpoint, MessageDispatcher).
 boolean isCreateDispatcherPerRequest()
          Controls whether dispatchers are cached or created per request.
 void passivate(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
          Invoked immediately before the given dispatcher is returned to its pool.
 boolean validate(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
          Invoked after the dispatcher is returned from a client but before it is prepared for return to its pool via passivate(OutboundEndpoint, MessageDispatcher).
 

Method Detail

isCreateDispatcherPerRequest

boolean isCreateDispatcherPerRequest()
Controls whether dispatchers are cached or created per request. Note that if an exception occurs in the dispatcher, it is automatically disposed of and a new one is created for the next request. This allows dispatchers to recover from loss of connection and other faults. When invoked by validate(OutboundEndpoint, MessageDispatcher) it takes precedence over the dispatcher's own return value of MessageDispatcher.validate().

Returns:
true if created per request

create

MessageDispatcher create(OutboundEndpoint endpoint)
                         throws MuleException
Creates a new message dispatcher instance, initialised with the passed endpoint. The returned instance should be immediately useable.

Parameters:
endpoint - the endoint for which this dispatcher should be created
Returns:
a properly created MessageDispatcher for this transport
Throws:
MuleException - if the dispatcher cannot be created

activate

void activate(OutboundEndpoint endpoint,
              MessageDispatcher dispatcher)
              throws MuleException
Invoked before the given dispatcher is handed out to a client, but not after create(OutboundEndpoint).

Parameters:
endpoint - the endpoint of the dispatcher
dispatcher - the dispatcher to be activated
Throws:
MuleException - if the dispatcher cannot be activated

validate

boolean validate(OutboundEndpoint endpoint,
                 MessageDispatcher dispatcher)
Invoked after the dispatcher is returned from a client but before it is prepared for return to its pool via passivate(OutboundEndpoint, MessageDispatcher).

Parameters:
endpoint - the endpoint of the dispatcher
dispatcher - the dispatcher to be validated
Returns:
true if the dispatcher is valid for reuse, false otherwise.

passivate

void passivate(OutboundEndpoint endpoint,
               MessageDispatcher dispatcher)
Invoked immediately before the given dispatcher is returned to its pool.

Parameters:
endpoint - the endpoint of the dispatcher
dispatcher - the dispatcher to be passivated

destroy

void destroy(OutboundEndpoint endpoint,
             MessageDispatcher dispatcher)
Invoked when a dispatcher returned false for validate(OutboundEndpoint, MessageDispatcher).

Parameters:
endpoint - the endpoint of the dispatcher
dispatcher - the dispatcher to be validated


Copyright © 2003-2011 MuleSoft, Inc.. All Rights Reserved.