org.mobicents.tools.sip.balancer
Interface BalancerAlgorithm

All Known Implementing Classes:
CallIDAffinityBalancerAlgorithm, DefaultBalancerAlgorithm, HeaderConsistentHashBalancerAlgorithm, PersistentConsistentHashBalancerAlgorithm

public interface BalancerAlgorithm

The BalancerAlgortihm interface exposes the methods implemented by decision making algorithms

Author:
vralev

Method Summary
 void assignToNode(java.lang.String id, SIPNode node)
          Assign callid to node
 BalancerContext getBalancerContext()
          Get the balancer context, which exposes useful information such as the available AS nodes at the moment or the listening points if you need the local address.
 java.util.Properties getProperties()
          Get the properties used to load the load balancer.
 void init()
          Lifecycle method.
 void jvmRouteSwitchover(java.lang.String fromJvmRoute, java.lang.String toJvmRoute)
          Move load from one node to another to follow mod_jk/mod_cluster
 void nodeAdded(SIPNode node)
          Notify the algorithm when a node is added.
 void nodeRemoved(SIPNode node)
          Notifying the algorithm when a node is dead.
 SIPNode processAssignedExternalRequest(javax.sip.message.Request request, SIPNode assignedNode)
           
 SIPNode processExternalRequest(javax.sip.message.Request request)
          When a request comes it is passed to the algorithm.
 void processExternalResponse(javax.sip.message.Response response)
          Allow algorithms to process responses
 SIPNode processHttpRequest(org.jboss.netty.handler.codec.http.HttpRequest request)
          Handle HttpRequests here.
 void processInternalRequest(javax.sip.message.Request request)
           
 void processInternalResponse(javax.sip.message.Response response)
           
 void setProperties(java.util.Properties properties)
          Also allows to change the properties completely when it makes sense
 void stop()
          Lifecycle method.
 

Method Detail

processExternalRequest

SIPNode processExternalRequest(javax.sip.message.Request request)
When a request comes it is passed to the algorithm. The algorithm must add the Route headers to the node or nodes where the request should go. The actual proxying is done at the LB. Allowing the algorithm to add headers allows more flexibility for example when you need to pass some information to the AS or the application to make further LB decisions or multiprotocol cooperative load balancing. It is very little effort for great flexibility.

Parameters:
request -
Returns:

processAssignedExternalRequest

SIPNode processAssignedExternalRequest(javax.sip.message.Request request,
                                       SIPNode assignedNode)

processInternalRequest

void processInternalRequest(javax.sip.message.Request request)

processHttpRequest

SIPNode processHttpRequest(org.jboss.netty.handler.codec.http.HttpRequest request)
Handle HttpRequests here. Use the Netty API for Http request analysis.

Parameters:
request -
Returns:

processExternalResponse

void processExternalResponse(javax.sip.message.Response response)
Allow algorithms to process responses

Parameters:
response -

processInternalResponse

void processInternalResponse(javax.sip.message.Response response)

nodeRemoved

void nodeRemoved(SIPNode node)
Notifying the algorithm when a node is dead.

Parameters:
node -

nodeAdded

void nodeAdded(SIPNode node)
Notify the algorithm when a node is added.

Parameters:
node -

getProperties

java.util.Properties getProperties()
Get the properties used to load the load balancer. This way you can read algorithm-specific settings from the main configuration file - the lb.properties.

Returns:

setProperties

void setProperties(java.util.Properties properties)
Also allows to change the properties completely when it makes sense

Parameters:
properties -

getBalancerContext

BalancerContext getBalancerContext()
Get the balancer context, which exposes useful information such as the available AS nodes at the moment or the listening points if you need the local address.

Returns:

jvmRouteSwitchover

void jvmRouteSwitchover(java.lang.String fromJvmRoute,
                        java.lang.String toJvmRoute)
Move load from one node to another to follow mod_jk/mod_cluster

Parameters:
fromJvmRoute -
toJvmRoute -

init

void init()
Lifecycle method. Notifies the algorithm when it's initialized with properties and balancer context.


stop

void stop()
Lifecycle method. Notifies the algorithm when it's being shut down.


assignToNode

void assignToNode(java.lang.String id,
                  SIPNode node)
Assign callid to node



Copyright © 2010. All Rights Reserved.