Author: ruwan
Date: Tue Jul 1 18:24:27 2008
New Revision: 673256
URL: http://svn.apache.org/viewvc?rev=673256&view=rev
Log:
committing for azeez, (SYNAPSE-372) finalized the issue after docs
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/LoadbalanceEndpointFactory.java
synapse/trunk/java/repository/conf/sample/synapse_sample_58.xml
synapse/trunk/java/src/site/xdoc/Synapse_Configuration_Language.xml
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/LoadbalanceEndpointFactory.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/LoadbalanceEndpointFactory.java?rev=673256&r1=673255&r2=673256&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/LoadbalanceEndpointFactory.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/LoadbalanceEndpointFactory.java
Tue Jul 1 18:24:27 2008
@@ -23,6 +23,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axis2.clustering.Member;
import org.apache.synapse.SynapseConstants;
+import org.apache.synapse.SynapseException;
import
org.apache.synapse.config.xml.endpoints.utils.LoadbalanceAlgorithmFactory;
import org.apache.synapse.config.xml.XMLConfigConstants;
import org.apache.synapse.endpoints.Endpoint;
@@ -79,6 +80,15 @@
// set endpoints or members
if
(loadbalanceElement.getFirstChildWithName(XMLConfigConstants.ENDPOINT_ELT) !=
null) {
+ if(loadbalanceElement.
+ getChildrenWithName((MEMBER)).hasNext()){
+ String msg =
+ "Invalid Synapse configuration. " +
+ "loadbalanceEndpoint element cannot have both
member & endpoint " +
+ "child elements";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
ArrayList<Endpoint> endpoints
= getEndpoints(loadbalanceElement,
loadbalanceEndpoint);
loadbalanceEndpoint.setEndpoints(endpoints);
@@ -86,6 +96,15 @@
LoadbalanceAlgorithmFactory.
createLoadbalanceAlgorithm(loadbalanceElement,
endpoints);
} else if (loadbalanceElement.getFirstChildWithName(MEMBER) !=
null) {
+ if(loadbalanceElement.
+
getChildrenWithName((XMLConfigConstants.ENDPOINT_ELT)).hasNext()){
+ String msg =
+ "Invalid Synapse configuration. " +
+ "loadbalanceEndpoint element cannot have both
member & endpoint " +
+ "child elements";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
List<Member> members = getMembers(loadbalanceElement);
loadbalanceEndpoint.setMembers(members);
algorithm =
Modified: synapse/trunk/java/repository/conf/sample/synapse_sample_58.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_58.xml?rev=673256&r1=673255&r2=673256&view=diff
==============================================================================
--- synapse/trunk/java/repository/conf/sample/synapse_sample_58.xml (original)
+++ synapse/trunk/java/repository/conf/sample/synapse_sample_58.xml Tue Jul 1
18:24:27 2008
@@ -25,9 +25,9 @@
<send>
<endpoint>
<loadbalance failover="true">
- <member ip="127.0.0.1" httpPort="9001"
httpsPort="9005"/>
- <member ip="127.0.0.1" httpPort="9002"
httpsPort="9006"/>
- <member ip="127.0.0.1" httpPort="9003"
httpsPort="9007"/>
+ <member hostName="127.0.0.1" httpPort="9001"
httpsPort="9005"/>
+ <member hostName="127.0.0.1" httpPort="9002"
httpsPort="9006"/>
+ <member hostName="127.0.0.1" httpPort="9003"
httpsPort="9007"/>
</loadbalance>
</endpoint>
</send>
Modified: synapse/trunk/java/src/site/xdoc/Synapse_Configuration_Language.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/src/site/xdoc/Synapse_Configuration_Language.xml?rev=673256&r1=673255&r2=673256&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/Synapse_Configuration_Language.xml
(original)
+++ synapse/trunk/java/src/site/xdoc/Synapse_Configuration_Language.xml Tue Jul
1 18:24:27 2008
@@ -604,17 +604,19 @@
</h4>
<p>
A Load balanced endpoint distributes the messages (load) arriving at it
- among a set of listed endpoints by evaluating the load balancing policy
- and any other relevant parameters. Policy attribute of the load balance
+ among a set of listed endpoints or static members by evaluating the load
balancing policy
+ and any other relevant parameters. The policy attribute of the load
balance
element specifies the load balance policy (algorithm) to be used for
- selecting the target endpoint. Currently only the roundRobin policy is
- supported. failover attribute determines if the next endpoint should be
- selected once the currently selected endpoint has failed, and defaults to
- true. The set of endpoints among which the load is distributed can be
- listed under the 'loadBalance' element. Those endpoints can belong to any
+ selecting the target endpoint or static member. Currently only the
roundRobin policy is
+ supported. The failover attribute determines if the next endpoint or
static member should be
+ selected once the currently selected endpoint or static member has
failed, and defaults to
+ true. The set of endpoints or static members amongst which the load has
to be distributed
+ can be listed under the 'loadBalance' element. These endpoints can
belong to any
endpoint type mentioned in this document. For example, failover endpoints
can be listed inside the load balance endpoint to load balance between
- failover groups etc.
+ failover groups etc. The loadbalance element cannot have both endpoint
& member child
+ elements in the same configuration. In the case of the member child
element, the hostName,
+ httpPort and/or httpsPort attributes could be specified.
</p>
<p>
The optional 'session' element makes the endpoint a session affinity
based
@@ -629,10 +631,13 @@
considered as set to false. If it is required to have failover behavior
in session
affinity based load balance endpoints, list failover endpoints as the
target endpoints.
</p>
-<pre xml:space="preserve"><session type="http|simpleClientSession"/>?
-<loadBalance [policy="roundRobin"] [failover="true|false"]>
- <endpoint .../>+
-</loadBalance></pre>
+ <pre xml:space="preserve">
+ <session type="http|simpleClientSession"/>?
+ <loadBalance [policy="roundRobin"] [failover="true|false"]>
+ <endpoint .../>+
+ <member hostName="host" [httpPort="port"] [httpsPort="port2"]>+
+ </loadBalance>
+ </pre>
<h4>
<a name="fail-over-endpoint" id="fail-over-endpoint">Failover
Endpoint</a>
</h4>
@@ -649,6 +654,37 @@
<pre xml:space="preserve"><failover>
<endpoint .../>+
</failover></pre>
+
+ <h4>
+ <a name="dynamic-load-balanced-endpoint"
id="dynamic-load-balanced-endpoint">Dynamic Load
+ balance Endpoint</a>
+ </h4>
+ <p>
+ A Dynamic Load balanced endpoint distributes the messages (load)
arriving at it
+ among a application members by evaluating the load balancing policy
+ and any other relevant parameters. These application members will be
discovered
+ using the membershipHandler class. Generally, this class will use a group
+ communication mechanism to discover the application members. The class
attribute of the
+ membershipHandler element should be an implementation of
+ org.apache.synapse.core.LoadBalanceMembershipHandler. membershipHandler
specific properties
+ can be specified using the property elements. The policy attribute of
the
+ dynamicLoadbalance
+ element specifies the load balance policy (algorithm) to be used for
+ selecting the next member to which the message has to be forwaded to.
+ Currently only the roundRobin policy is
+ supported. The failover attribute determines if the next member should be
+ selected once the currently selected member has failed, and defaults to
+ true.
+ </p>
+ <!--TODO: Session affinity documentation-->
+ <pre xml:space="preserve">
+ <dynamicLoadBalance [policy="roundRobin"] [failover="true|false"]>
+ <membershipHandler
+ class="impl of
org.apache.synapse.core.LoadBalanceMembershipHandler">
+ <property name="name" value="value"/>+
+ </membershipHandler>
+ </dynamicLoadBalance>
+ </pre>
<h2>
<a name="proxy" id="proxy">Proxy service</a>
</h2>