Class LoadBalancingInterceptor
java.lang.Object
com.predic8.membrane.core.interceptor.AbstractInterceptor
com.predic8.membrane.core.interceptor.balancer.LoadBalancingInterceptor
- All Implemented Interfaces:
Interceptor
- Description
- Performs load-balancing between several nodes. Nodes sharing session state may be bundled into a cluster.
- Explanation
- May only be used as interceptor in a ServiceProxy.
- Topic
- 7. Clustering and Loadbalancing
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.predic8.membrane.core.interceptor.Interceptor
Interceptor.Flow -
Field Summary
Fields inherited from class com.predic8.membrane.core.interceptor.AbstractInterceptor
name, router -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()This is *NOT*AbstractInterceptor.getDisplayName(), but the balancer's name set in the proxy configuration to identify this balancer.longvoidhandleAbort(Exchange exc) Called when anyInterceptor.handleRequest(Exchange)orInterceptor.handleResponse(Exchange)later in the chain returnedOutcome.ABORTor threw an exception.handleRequest(Exchange exc) handleResponse(Exchange exc) voidinit()Called after parsing is complete and this has been added to the object tree (whose root is Router).voidbooleanvoidsetClustersFromSpring(List<Balancer> balancers) voidsetDispatchingStrategy(DispatchingStrategy strategy) voidsetFailOver(boolean failOver) voidThis is *NOT*AbstractInterceptor.setDisplayName(String), but the balancer's name set in the proxy configuration to identify this balancer.voidvoidsetSessionIdExtractor(AbstractSessionIdExtractor sessionIdExtractor) voidsetSessionTimeout(long sessionTimeout) Methods inherited from class com.predic8.membrane.core.interceptor.AbstractInterceptor
getDisplayName, getFlow, getHelpId, getLongDescription, getMessage, getRouter, getRule, setDisplayName, setFlow
-
Constructor Details
-
LoadBalancingInterceptor
public LoadBalancingInterceptor()
-
-
Method Details
-
init
- Specified by:
initin interfaceInterceptor- Overrides:
initin classAbstractInterceptor- Throws:
Exception
-
handleRequest
- Specified by:
handleRequestin interfaceInterceptor- Overrides:
handleRequestin classAbstractInterceptor- Throws:
Exception
-
handleAbort
Description copied from interface:InterceptorCalled when anyInterceptor.handleRequest(Exchange)orInterceptor.handleResponse(Exchange)later in the chain returnedOutcome.ABORTor threw an exception.handleAbort is called in the reverse order of the chain (as handleResponse is).
- Specified by:
handleAbortin interfaceInterceptor- Overrides:
handleAbortin classAbstractInterceptor
-
handleResponse
- Specified by:
handleResponsein interfaceInterceptor- Overrides:
handleResponsein classAbstractInterceptor- Throws:
Exception
-
setName
This is *NOT*AbstractInterceptor.setDisplayName(String), but the balancer's name set in the proxy configuration to identify this balancer.- Throws:
Exception- Default
- Default
- Description
- Uniquely identifies this Load Balancer, if there is more than one. Used in the web administration interface and lbclient to manage nodes.
- Example
- balancer1
-
getName
This is *NOT*AbstractInterceptor.getDisplayName(), but the balancer's name set in the proxy configuration to identify this balancer. -
getDispatchingStrategy
-
setDispatchingStrategy
- Description
- Sets the strategy used to choose the backend nodes.
-
getEndpoints
-
getSessionIdExtractor
-
setNodeOnlineChecker
- Description
- Checks if nodes are still available. Sets them to "DOWN" when not reachable, else sets them back up when they are reachable.
-
getNodeOnlineChecker
-
setSessionIdExtractor
- Description
- Sets the strategy used to extract a session ID from incoming HTTP requests.
-
isFailOver
public boolean isFailOver() -
setFailOver
public void setFailOver(boolean failOver) -
getClusterManager
-
setClustersFromSpring
- Description
- Specifies a list of clusters.
-
getClustersFromSpring
-
getSessionTimeout
public long getSessionTimeout() -
setSessionTimeout
public void setSessionTimeout(long sessionTimeout) - Default
- 3600000
- Description
- Time in milliseconds after which sessions time out. (If a session extractor is used.) Default is 1 hour, 0 means never.
- Example
- 600000 (10min)
-
getShortDescription
- Specified by:
getShortDescriptionin interfaceInterceptor- Overrides:
getShortDescriptionin classAbstractInterceptor
-
init
Description copied from class:AbstractInterceptorCalled after parsing is complete and this has been added to the object tree (whose root is Router).- Overrides:
initin classAbstractInterceptor- Throws:
Exception
-