org.apache.synapse.endpoints
Class FailoverEndpoint

java.lang.Object
  extended by org.apache.synapse.FaultHandler
      extended by org.apache.synapse.endpoints.AbstractEndpoint
          extended by org.apache.synapse.endpoints.FailoverEndpoint
All Implemented Interfaces:
Endpoint, ManagedLifecycle, Nameable, PropertyInclude, SynapseArtifact

public class FailoverEndpoint
extends AbstractEndpoint

FailoverEndpoint can have multiple child endpoints. It will always try to send messages to current endpoint. If the current endpoint is failing, it gets another active endpoint from the list and make it the current endpoint. Then the message is sent to the current endpoint and if it fails, above procedure repeats until there are no active endpoints. If all endpoints are failing and parent endpoint is available, this will delegate the problem to the parent endpoint. If parent endpoint is not available it will pop the next FaultHandler and delegate the problem to that.


Field Summary
 
Fields inherited from class org.apache.synapse.endpoints.AbstractEndpoint
anonymous, errorHandler, fileName, initialized, isClusteringEnabled, log, trace
 
Constructor Summary
FailoverEndpoint()
           
 
Method Summary
 boolean isDynamic()
           
 void onChildEndpointFail(Endpoint endpoint, MessageContext synMessageContext)
          Endpoints that contain other endpoints should implement this method.
 boolean readyToSend()
          Returns true to indicate that the endpoint is ready to service requests
 void send(MessageContext synCtx)
          Sends the message context according to an endpoint specific behavior.
 void setDynamic(boolean dynamic)
           
 
Methods inherited from class org.apache.synapse.endpoints.AbstractEndpoint
addProperties, addProperty, destroy, evaluateProperties, getChildren, getContext, getDefinition, getDescription, getErrorHandler, getFileName, getMetricsMBean, getName, getParentEndpoint, getProperties, getProperty, handleException, handleException, informFailure, init, isAnonymous, isInitialized, isLeafEndpoint, isRetryDisabled, isSuspendFault, isTimeout, isTraceOn, isTraceOrDebugOn, logOnChildEndpointFail, onFault, onSuccess, prepareForEndpointStatistics, removeProperty, setAnonymous, setChildren, setDefinition, setDescription, setEnableMBeanStats, setErrorHandler, setErrorOnMessage, setFileName, setName, setParentEndpoint, toString, traceOrDebug
 
Methods inherited from class org.apache.synapse.FaultHandler
getStackTrace, handleFault, handleFault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FailoverEndpoint

public FailoverEndpoint()
Method Detail

send

public void send(MessageContext synCtx)
Description copied from interface: Endpoint
Sends the message context according to an endpoint specific behavior.

Specified by:
send in interface Endpoint
Overrides:
send in class AbstractEndpoint
Parameters:
synCtx - MessageContext to be sent.

onChildEndpointFail

public void onChildEndpointFail(Endpoint endpoint,
                                MessageContext synMessageContext)
Description copied from interface: Endpoint
Endpoints that contain other endpoints should implement this method. It will be called if a child endpoint causes an exception. Action to be taken on such failure is up to the implementation. But it is good practice to first try addressing the issue. If it can't be addressed propagate the exception to parent endpoint by calling parent endpoint's onChildEndpointFail(...) method.

Specified by:
onChildEndpointFail in interface Endpoint
Overrides:
onChildEndpointFail in class AbstractEndpoint
Parameters:
endpoint - The child endpoint which caused the exception.
synMessageContext - MessageContext that was used in the failed attempt.

readyToSend

public boolean readyToSend()
Description copied from interface: Endpoint
Returns true to indicate that the endpoint is ready to service requests

Specified by:
readyToSend in interface Endpoint
Overrides:
readyToSend in class AbstractEndpoint
Returns:
true if endpoint is ready to service requests

isDynamic

public boolean isDynamic()

setDynamic

public void setDynamic(boolean dynamic)


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