org.apache.synapse.endpoints.dispatch
Interface Dispatcher

All Known Implementing Classes:
HttpSessionDispatcher, SimpleClientSessionDispatcher, SoapSessionDispatcher

public interface Dispatcher

Defines the behavior of session dispatchers. There can be two dispatcher types. Server initiated session dispatchers and client initiated session dispatchers. In the former one, server generates the session ID and sends it to the client in the first RESPONSE. In the later case, client should generate the session ID and send it to the server in the first REQUEST. A dispatcher object will be created for each session affinity load balance endpoint.


Method Summary
 Endpoint getEndpoint(MessageContext synCtx, DispatcherContext dispatcherContext)
          Dispatcher should check the session id pattern in the synapseMessageContext and return the matching endpoint for that session id, if available.
 boolean isServerInitiatedSession()
          Determine whether the session supported by the implementing dispatcher is initiated by the server (e.g.
 void unbind(MessageContext synCtx, DispatcherContext dispatcherContext)
          Removes the session belonging to the given message context.
 void updateSession(MessageContext synCtx, DispatcherContext dispatcherContext, Endpoint endpoint)
          Updates the session maps.
 

Method Detail

getEndpoint

Endpoint getEndpoint(MessageContext synCtx,
                     DispatcherContext dispatcherContext)
Dispatcher should check the session id pattern in the synapseMessageContext and return the matching endpoint for that session id, if available. If the session id in the given synapseMessageContext is not found it should return null.

Parameters:
synCtx - client -> esb message context.
dispatcherContext - context for dispatching
Returns:
Endpoint Endpoint associated with this session.

updateSession

void updateSession(MessageContext synCtx,
                   DispatcherContext dispatcherContext,
                   Endpoint endpoint)
Updates the session maps. This will be called in the first client -> synapse -> server flow for client initiated sessions. For server initiated sessions, this will be called in the first server -> synapse -> client flow.

Parameters:
synCtx - SynapseMessageContext
dispatcherContext - context for dispatching
endpoint - Selected endpoint for this session.

unbind

void unbind(MessageContext synCtx,
            DispatcherContext dispatcherContext)
Removes the session belonging to the given message context.

Parameters:
synCtx - MessageContext containing an session ID.
dispatcherContext - context for dispatching

isServerInitiatedSession

boolean isServerInitiatedSession()
Determine whether the session supported by the implementing dispatcher is initiated by the server (e.g. soap session) or by the client. This can be used for optimizing session updates.

Returns:
true, if the session is initiated by the server. false, otherwise.


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.