Added: synapse/site/3_0_1/userguide/samples/sample54.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample54.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample54.html (added) +++ synapse/site/3_0_1/userguide/samples/sample54.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,241 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-04 + | Rendered using Apache Maven Fluido Skin 1.6 +--> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="Date-Revision-yyyymmdd" content="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 54</title> + <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" /> + <link rel="stylesheet" href="../../css/site.css" /> + <link rel="stylesheet" href="../../css/print.css" media="print" /> + <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script> + </head> + <body class="topBarDisabled"> + <div class="container-fluid"> + <div id="banner"> + <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2> +</div> +</div> + <div class="pull-right"></div> + <div class="clear"><hr/></div> + </div> + + <div id="breadcrumbs"> + <ul class="breadcrumb"> + <li id="publishDate">Last Published: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</li> + </ul> + </div> + <div class="row-fluid"> + <div id="leftColumn" class="span2"> + <div class="well sidebar-nav"> +<ul class="nav nav-list"> + <li class="nav-header">Main Menu</li> + <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li> + <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li> + <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li> + <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li> + <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li> + <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li> + <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li> + <li class="nav-header">Documentation</li> + <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li> + <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li> + <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li> + <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li> + <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li> + <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li> + <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li> + <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li> + <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li> + <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li> + <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li> + <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li> + <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li> + <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li> + <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li> + <li class="nav-header">Developer Resources</li> + <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li> + <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li> + <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li> + <li class="nav-header">Project Details</li> + <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li> + <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li> + <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li> + <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li> + <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li> + <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li> + </ul> + <hr /> + <div id="poweredBy"> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a> + </div> + </div> + </div> + <div id="bodyColumn" class="span10" > + + + <div class="section"> +<h2><a name="Sample_54:_Session_Affinity_Load_Balancing_Between_3_Endpoints"></a>Sample 54: Session Affinity Load Balancing Between 3 Endpoints</h2> + +<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> + + <sequence name="main" onError="errorHandler"> + <in> + <send> + <endpoint> + <!-- specify the session as the simple client session provided by Synapse for + testing purpose --> + <session type="simpleClientSession"/> + + <loadbalance> + <endpoint> + <address uri="http://localhost:9001/services/LBService1"> + <enableAddressing/> + </address> + </endpoint> + <endpoint> + <address uri="http://localhost:9002/services/LBService1"> + <enableAddressing/> + </address> + </endpoint> + <endpoint> + <address uri="http://localhost:9003/services/LBService1"> + <enableAddressing/> + </address> + </endpoint> + </loadbalance> + </endpoint> + </send> + <drop/> + </in> + + <out> + <!-- Send the messages where they have been sent (i.e. implicit To EPR) --> + <send/> + </out> + </sequence> + + <sequence name="errorHandler"> + <makefault response="true"> + <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/> + <reason value="COULDN'T SEND THE MESSAGE TO THE SERVER."/> + </makefault> + <send/> + </sequence> + +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Showcase the ability of Synapse to act as a session aware load balancer with + simple client sessions + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Deploy the LoadbalanceFailoverService in the sample Axis2 server (go to + samples/axis2Server/src/LoadbalanceFailoverService and run 'ant') + </li> + +<li> + Start 3 instances of the Axis2 server on different ports as follows + +<div class="command">./axis2server.sh -http 9001 -https 9005 -name MyServer1<br /> +./axis2server.sh -http 9002 -https 9006 -name MyServer2<br /> +./axis2server.sh -http 9003 -https 9007 -name MyServer3</div> + </li> + +<li> + Start Synapse using the configuration numbered 54 (repository/conf/sample/synapse_sample_54.xml) + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 54<br /> + Windows: synapse.bat -sample 54 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + Above configuration is same as the load balancing configuration in + <a href="sample52.html">sample 52</a>, except that the session type is specified + as 'simpleClientSession'. This is a client initiated session, which means that + the client generates the session identifier and sends it with each request. In + this sample, client adds a SOAP header named ClientID containing the identifier + of the client. Synapse binds this ID with a server on the first request and sends + all successive requests containing that ID to the same server. Now switch to + samples/axis2Client directory and run the client using the following command to + check this in action. + </p> + +<div class="command">ant loadbalancefailover -Dmode=session</div> + +<p> + In the session mode, client continuously sends requests with three different + client (session) IDs. One ID is selected among these three IDs for each request + randomly. Then client prints the session ID with the responded server for each + request. Client output for the first 10 requests are shown below. + </p> + +<div class="consoleOutput">[java] Request: 1 Session number: 1 Response from server: MyServer3 +[java] Request: 2 Session number: 2 Response from server: MyServer2 +[java] Request: 3 Session number: 0 Response from server: MyServer1 +[java] Request: 4 Session number: 2 Response from server: MyServer2 +[java] Request: 5 Session number: 1 Response from server: MyServer3 +[java] Request: 6 Session number: 2 Response from server: MyServer2 +[java] Request: 7 Session number: 2 Response from server: MyServer2 +[java] Request: 8 Session number: 1 Response from server: MyServer3 +[java] Request: 9 Session number: 0 Response from server: MyServer1 +[java] Request: 10 Session number: 0 Response from server: MyServer1 +... </div> + +<p> + You can see that session ID 0 is always directed to the server named MyServer1. + That means session ID 0 is bound to MyServer1. Similarly session 1 and 2 are bound + to MyServer3 and MyServer2 respectively. + </p> + </div> + </div> + +<p><a href="../samples.html">Back to Catalog</a></p> + + + </div> + </div> + </div> + <hr/> + <footer> + <div class="container-fluid"> + <div class="row-fluid"> + <p>Copyright ©2005–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html>
Added: synapse/site/3_0_1/userguide/samples/sample55.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample55.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample55.html (added) +++ synapse/site/3_0_1/userguide/samples/sample55.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,269 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-04 + | Rendered using Apache Maven Fluido Skin 1.6 +--> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="Date-Revision-yyyymmdd" content="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 55</title> + <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" /> + <link rel="stylesheet" href="../../css/site.css" /> + <link rel="stylesheet" href="../../css/print.css" media="print" /> + <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script> + </head> + <body class="topBarDisabled"> + <div class="container-fluid"> + <div id="banner"> + <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2> +</div> +</div> + <div class="pull-right"></div> + <div class="clear"><hr/></div> + </div> + + <div id="breadcrumbs"> + <ul class="breadcrumb"> + <li id="publishDate">Last Published: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</li> + </ul> + </div> + <div class="row-fluid"> + <div id="leftColumn" class="span2"> + <div class="well sidebar-nav"> +<ul class="nav nav-list"> + <li class="nav-header">Main Menu</li> + <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li> + <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li> + <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li> + <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li> + <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li> + <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li> + <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li> + <li class="nav-header">Documentation</li> + <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li> + <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li> + <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li> + <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li> + <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li> + <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li> + <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li> + <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li> + <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li> + <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li> + <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li> + <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li> + <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li> + <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li> + <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li> + <li class="nav-header">Developer Resources</li> + <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li> + <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li> + <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li> + <li class="nav-header">Project Details</li> + <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li> + <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li> + <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li> + <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li> + <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li> + <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li> + </ul> + <hr /> + <div id="poweredBy"> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a> + </div> + </div> + </div> + <div id="bodyColumn" class="span10" > + + + <div class="section"> +<h2><a name="Sample_55:_Session_Affinity_Load_Balancing_Between_Fail-over_Endpoints"></a>Sample 55: Session Affinity Load Balancing Between Fail-over Endpoints</h2> + +<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> + + <sequence name="main" onError="errorHandler"> + <in> + <send> + <endpoint> + <!-- specify the session as the simple client session provided by Synapse for + testing purpose --> + <session type="simpleClientSession"/> + + <loadbalance> + <endpoint> + <failover> + <endpoint> + <address uri="http://localhost:9001/services/LBService1"> + <enableAddressing/> + </address> + </endpoint> + <endpoint> + <address uri="http://localhost:9002/services/LBService1"> + <enableAddressing/> + </address> + </endpoint> + </failover> + </endpoint> + <endpoint> + <failover> + <endpoint> + <address uri="http://localhost:9003/services/LBService1"> + <enableAddressing/> + </address> + </endpoint> + <endpoint> + <address uri="http://localhost:9004/services/LBService1"> + <enableAddressing/> + </address> + </endpoint> + </failover> + </endpoint> + </loadbalance> + </endpoint> + </send> + <drop/> + </in> + + <out> + <!-- Send the messages where they have been sent (i.e. implicit To EPR) --> + <send/> + </out> + </sequence> + + <sequence name="errorHandler"> + <makefault response="true"> + <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/> + <reason value="COULDN'T SEND THE MESSAGE TO THE SERVER."/> + </makefault> + <send/> + </sequence> + +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Demonstrate session aware load balancing in conjunction with fail-over + routing. + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Deploy the LoadbalanceFailoverService in the sample Axis2 server (go to + samples/axis2Server/src/LoadbalanceFailoverService and run 'ant') + </li> + +<li> + Start 4 instances of the Axis2 server on different ports as follows + +<div class="command">./axis2server.sh -http 9001 -https 9005 -name MyServer1<br /> +./axis2server.sh -http 9002 -https 9006 -name MyServer2<br /> +./axis2server.sh -http 9003 -https 9007 -name MyServer3<br /> +./axis2server.sh -http 9004 -https 9008 -name MyServer4</div> + </li> + +<li> + Start Synapse using the configuration numbered 55 (repository/conf/sample/synapse_sample_55.xml) + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 55<br /> + Windows: synapse.bat -sample 55 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + This configuration also uses 'simpleClientSession' to bind session ID values to + servers as in <a href="sample54.html">sample 54</a>. But fail-over endpoints are + specified as the child endpoints of the load balance endpoint. Therefore sessions + are bound to the fail-over endpoints. Session information has to be replicated + among the servers listed under each failover endpoint using some clustering + mechanism. Therefore, if one endpoint bound to a session failed, successive requets + for that session will be directed to the next endpoint in that failover group. + Run the client using the following command to observe this behaviour. + </p> + +<div class="command">ant loadbalancefailover -Dmode=session</div> + +<p> + You can see a client output as shown below. + </p> + +<div class="consoleOutput">... +[java] Request: 222 Session number: 0 Response from server: MyServer1 +[java] Request: 223 Session number: 0 Response from server: MyServer1 +[java] Request: 224 Session number: 1 Response from server: MyServer1 +[java] Request: 225 Session number: 2 Response from server: MyServer3 +[java] Request: 226 Session number: 0 Response from server: MyServer1 +[java] Request: 227 Session number: 1 Response from server: MyServer1 +[java] Request: 228 Session number: 2 Response from server: MyServer3 +[java] Request: 229 Session number: 1 Response from server: MyServer1 +[java] Request: 230 Session number: 1 Response from server: MyServer1 +[java] Request: 231 Session number: 2 Response from server: MyServer3 +...</div> + +<p> + Note that session 0 is always directed to MyServer1 and session 2 is directed to + MyServer3. No requests are directed to MyServer2 and MyServer4 as they are kept + as backups by fail-over endpoints. Now shutdown the server named MyServer1 while + running the sample. You will observe that all successive requests for session 0 + is now directed to MyServer2, which is the backup server for MyServer1's group. + This is shown below, where MyServer1 was shutdown after the request 534. + </p> + +<div class="consoleOutput">... +[java] Request: 529 Session number: 2 Response from server: MyServer3 +[java] Request: 530 Session number: 1 Response from server: MyServer1 +[java] Request: 531 Session number: 0 Response from server: MyServer1 +[java] Request: 532 Session number: 1 Response from server: MyServer1 +[java] Request: 533 Session number: 1 Response from server: MyServer1 +[java] Request: 534 Session number: 1 Response from server: MyServer1 +[java] Request: 535 Session number: 0 Response from server: MyServer2 +[java] Request: 536 Session number: 0 Response from server: MyServer2 +[java] Request: 537 Session number: 0 Response from server: MyServer2 +[java] Request: 538 Session number: 2 Response from server: MyServer3 +[java] Request: 539 Session number: 0 Response from server: MyServer2 +...</div> + </div> + </div> + +<p><a href="../samples.html">Back to Catalog</a></p> + + + </div> + </div> + </div> + <hr/> + <footer> + <div class="container-fluid"> + <div class="row-fluid"> + <p>Copyright ©2005–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html> Added: synapse/site/3_0_1/userguide/samples/sample56.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample56.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample56.html (added) +++ synapse/site/3_0_1/userguide/samples/sample56.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,198 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-04 + | Rendered using Apache Maven Fluido Skin 1.6 +--> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="Date-Revision-yyyymmdd" content="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 56</title> + <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" /> + <link rel="stylesheet" href="../../css/site.css" /> + <link rel="stylesheet" href="../../css/print.css" media="print" /> + <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script> + </head> + <body class="topBarDisabled"> + <div class="container-fluid"> + <div id="banner"> + <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2> +</div> +</div> + <div class="pull-right"></div> + <div class="clear"><hr/></div> + </div> + + <div id="breadcrumbs"> + <ul class="breadcrumb"> + <li id="publishDate">Last Published: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</li> + </ul> + </div> + <div class="row-fluid"> + <div id="leftColumn" class="span2"> + <div class="well sidebar-nav"> +<ul class="nav nav-list"> + <li class="nav-header">Main Menu</li> + <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li> + <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li> + <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li> + <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li> + <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li> + <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li> + <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li> + <li class="nav-header">Documentation</li> + <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li> + <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li> + <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li> + <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li> + <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li> + <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li> + <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li> + <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li> + <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li> + <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li> + <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li> + <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li> + <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li> + <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li> + <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li> + <li class="nav-header">Developer Resources</li> + <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li> + <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li> + <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li> + <li class="nav-header">Project Details</li> + <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li> + <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li> + <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li> + <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li> + <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li> + <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li> + </ul> + <hr /> + <div id="poweredBy"> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a> + </div> + </div> + </div> + <div id="bodyColumn" class="span10" > + + + <div class="section"> +<h2><a name="Sample_56:_WSDL_Endpoint"></a>Sample 56: WSDL Endpoint</h2> + +<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> + + <sequence name="main"> + <in> + <send> + <!-- get epr from the given wsdl --> + <endpoint> + <wsdl uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl" + service="SimpleStockQuoteService" + port="SimpleStockQuoteServiceHttpSoap11Endpoint"/> + </endpoint> + </send> + </in> + + <out> + <send/> + </out> + </sequence> + +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Showcase the ability of Synapse to use a WSDL as the target endpoint + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2 + </li> + +<li> + Start Synapse using the configuration numbered 56 (repository/conf/sample/synapse_sample_56.xml) + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 56<br /> + Windows: synapse.bat -sample 56 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + This sample uses a WSDL endpoint inside the send mediator. WSDL endpoints can + extract endpoint's address from the given WSDL. As WSDL documents can have many + services and many ports inside each service, the service and port of the + required endpoint has to be specified. As with address endpoints, QoS parameters + for the endpoint can be specified in-line in the configuration. An excerpt taken + from the sample_proxy_1.wsdl containing the specified service and port is + listed below. + </p> + +<div class="xmlConf"><wsdl:service name="SimpleStockQuoteService"> + <wsdl:port name="SimpleStockQuoteServiceHttpSoap11Endpoint" binding="ns:SimpleStockQuoteServiceSoap11Binding"> + <soap:address location="http://localhost:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpSoap11Endpoint"/> + </wsdl:port> + <wsdl:port name="SimpleStockQuoteServiceHttpSoap12Endpoint" binding="ns:SimpleStockQuoteServiceSoap12Binding"> + <soap12:address location="http://localhost:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpSoap12Endpoint"/> + </wsdl:port> +</wsdl:service></div> + +<p> + Specified service and port refers to the endpoint address 'http://localhost:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpSoap11Endpoint' + according to the above WSDL. Now run the client using the following command. + </p> + +<div class="command">ant stockquote -Daddurl=http://localhost:8280/</div> + +<p> + Client will print the quote price for IBM received from the server running on + port 9000. + </p> + +<div class="consoleOutput">Standard :: Stock price = $95.26454380258552</div> + </div> + </div> + +<p><a href="../samples.html">Back to Catalog</a></p> + + + </div> + </div> + </div> + <hr/> + <footer> + <div class="container-fluid"> + <div class="row-fluid"> + <p>Copyright ©2005–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html> Added: synapse/site/3_0_1/userguide/samples/sample57.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample57.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample57.html (added) +++ synapse/site/3_0_1/userguide/samples/sample57.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,256 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-04 + | Rendered using Apache Maven Fluido Skin 1.6 +--> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="Date-Revision-yyyymmdd" content="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 57</title> + <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" /> + <link rel="stylesheet" href="../../css/site.css" /> + <link rel="stylesheet" href="../../css/print.css" media="print" /> + <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script> + </head> + <body class="topBarDisabled"> + <div class="container-fluid"> + <div id="banner"> + <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2> +</div> +</div> + <div class="pull-right"></div> + <div class="clear"><hr/></div> + </div> + + <div id="breadcrumbs"> + <ul class="breadcrumb"> + <li id="publishDate">Last Published: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</li> + </ul> + </div> + <div class="row-fluid"> + <div id="leftColumn" class="span2"> + <div class="well sidebar-nav"> +<ul class="nav nav-list"> + <li class="nav-header">Main Menu</li> + <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li> + <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li> + <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li> + <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li> + <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li> + <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li> + <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li> + <li class="nav-header">Documentation</li> + <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li> + <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li> + <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li> + <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li> + <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li> + <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li> + <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li> + <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li> + <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li> + <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li> + <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li> + <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li> + <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li> + <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li> + <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li> + <li class="nav-header">Developer Resources</li> + <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li> + <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li> + <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li> + <li class="nav-header">Project Details</li> + <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li> + <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li> + <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li> + <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li> + <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li> + <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li> + </ul> + <hr /> + <div id="poweredBy"> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a> + </div> + </div> + </div> + <div id="bodyColumn" class="span10" > + + + <div class="section"> +<h2><a name="Sample_57:_Dynamic_Load_Balancing_Between_3_Nodes"></a>Sample 57: Dynamic Load Balancing Between 3 Nodes</h2> + +<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> + + <sequence name="main" onError="errorHandler"> + <in> + <send> + <endpoint name="dynamicLB"> + <dynamicLoadbalance failover="true" + algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin"> + <membershipHandler + class="org.apache.synapse.core.axis2.Axis2LoadBalanceMembershipHandler"> + <property name="applicationDomain" value="apache.axis2.app.domain"/> + </membershipHandler> + </dynamicLoadbalance> + </endpoint> + </send> + <drop/> + </in> + + <out> + <!-- Send the messages where they have been sent (i.e. implicit To EPR) --> + <send/> + </out> + </sequence> + + <sequence name="errorHandler"> + <makefault response="true"> + <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/> + <reason value="COULDN'T SEND THE MESSAGE TO THE SERVER."/> + </makefault> + <send/> + </sequence> + +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Demonstrate the ability of Synapse to perform dynamic load balancing. In + dynamic load balancing, nodes can be added and removed from the pool dynamically. + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Deploy the LoadbalanceFailoverService by switching to samples/axis2Server/src/LoadbalanceFailoverService + directory and running 'ant'. + </li> + +<li> + Enable clustering for the sample Axis2 server. Edit the axis2.xml file at + samples/axis2Server/repository/conf directory and set the 'enable' attribute + on the 'clustering' element to 'true'. Specify the IP address of the + machine as the values of 'mcastBindAddress' and 'localMemberHost' + parameters. + </li> + +<li> + Enable clustering for Synapse by editing repository/conf/axis2.xml file. + This should be done by setting the 'enable' attribute of the 'clustering' + element to 'true'. Also provide the IP address of your machine as the + values of the 'mcastBindAddress' and 'localMemberHost' parameters. In + addition also set the 'enable' attribute on 'groupManagement' element + to 'true'. + </li> + +<li> + Start Synapse using the configuration numbered 57 (repository/conf/sample/synapse_sample_57.xml) + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 57<br /> + Windows: synapse.bat -sample 57 + </div> + </li> + +<li> + Start 3 instances of the sample Axis2 server as follows. + +<div class="command">./axis2server.sh -http 9001 -https 9005 -name MyServer1<br /> +./axis2server.sh -http 9002 -https 9006 -name MyServer2<br /> +./axis2server.sh -http 9003 -https 9007 -name MyServer3</div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + Note that the Synapse configuration does not define any concrete addresses or + URLs as targets. They are discovered dynamically by the dynamic load balance + endpoint. To test this feature start the load balance and failover client using + the following command: + </p> + +<div class="command">ant loadbalancefailover -Di=100</div> + +<p> + This client sends 100 requests to the LoadbalanceFailoverService through Synapse. + Synapse will distribute the load among the three nodes we have started + in round-robin manner. LoadbalanceFailoverService appends the name of the server + to the response, so that client can determine which server has processed the message. + If you examine the console output of the client, you can see that requests are + processed by three servers as follows: + </p> + +<div class="consoleOutput">[java] Request: 1 ==> Response from server: MyServer1 +[java] Request: 2 ==> Response from server: MyServer2 +[java] Request: 3 ==> Response from server: MyServer3 +[java] Request: 4 ==> Response from server: MyServer1 +[java] Request: 5 ==> Response from server: MyServer2 +[java] Request: 6 ==> Response from server: MyServer3 +[java] Request: 7 ==> Response from server: MyServer1 +...</div> + +<p> + Now run the client without the -Di=100 parameter, to send infinite requests. While + running the client shutdown the server named MyServer1. You can observe that + requests are only distributed among MyServer2 and MyServer3 after shutting down + MyServer1. Console output before and after shutting down MyServer1 is listed below + (MyServer1 was shutdown after request 63): + </p> + +<div class="consoleOutput">... +[java] Request: 61 ==> Response from server: MyServer1 +[java] Request: 62 ==> Response from server: MyServer2 +[java] Request: 63 ==> Response from server: MyServer3 +[java] Request: 64 ==> Response from server: MyServer2 +[java] Request: 65 ==> Response from server: MyServer3 +[java] Request: 66 ==> Response from server: MyServer2 +[java] Request: 67 ==> Response from server: MyServer3 +...</div> + +<p> + Now restart MyServer1. You can observe that requests will be again sent to all + three servers. If you start a new Axis2 instance (say MyServer4) that will also + be added to the load balance pool dynamically. + </p> + </div> + </div> + +<p><a href="../samples.html">Back to Catalog</a></p> + + + </div> + </div> + </div> + <hr/> + <footer> + <div class="container-fluid"> + <div class="row-fluid"> + <p>Copyright ©2005–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html> Added: synapse/site/3_0_1/userguide/samples/sample58.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample58.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample58.html (added) +++ synapse/site/3_0_1/userguide/samples/sample58.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,235 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-04 + | Rendered using Apache Maven Fluido Skin 1.6 +--> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="Date-Revision-yyyymmdd" content="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 58</title> + <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" /> + <link rel="stylesheet" href="../../css/site.css" /> + <link rel="stylesheet" href="../../css/print.css" media="print" /> + <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script> + </head> + <body class="topBarDisabled"> + <div class="container-fluid"> + <div id="banner"> + <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2> +</div> +</div> + <div class="pull-right"></div> + <div class="clear"><hr/></div> + </div> + + <div id="breadcrumbs"> + <ul class="breadcrumb"> + <li id="publishDate">Last Published: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</li> + </ul> + </div> + <div class="row-fluid"> + <div id="leftColumn" class="span2"> + <div class="well sidebar-nav"> +<ul class="nav nav-list"> + <li class="nav-header">Main Menu</li> + <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li> + <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li> + <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li> + <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li> + <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li> + <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li> + <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li> + <li class="nav-header">Documentation</li> + <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li> + <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li> + <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li> + <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li> + <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li> + <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li> + <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li> + <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li> + <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li> + <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li> + <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li> + <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li> + <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li> + <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li> + <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li> + <li class="nav-header">Developer Resources</li> + <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li> + <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li> + <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li> + <li class="nav-header">Project Details</li> + <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li> + <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li> + <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li> + <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li> + <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li> + <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li> + </ul> + <hr /> + <div id="poweredBy"> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a> + </div> + </div> + </div> + <div id="bodyColumn" class="span10" > + + + <div class="section"> +<h2><a name="Sample_58:_Static_Load_Balancing_Between_3_Nodes"></a>Sample 58: Static Load Balancing Between 3 Nodes</h2> + +<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> + + <sequence name="main" onError="errorHandler"> + <in> + <send> + <endpoint> + <loadbalance failover="true"> + <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> + <drop/> + </in> + + <out> + <!-- Send the messages where they have been sent (i.e. implicit To EPR) --> + <send/> + </out> + </sequence> + + <sequence name="errorHandler"> + <makefault response="true"> + <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/> + <reason value="COULDN'T SEND THE MESSAGE TO THE SERVER."/> + </makefault> + <send/> + </sequence> + +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Demonstrate the ability of Synapse to act as a load balancer for a set of + servers hosting stateless services. This sample is very similar to + <a href="sample52.html">sample 52</a> but uses a different syntax style to + configure the load balance endpoint. + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Deploy the LoadbalanceFailoverService in the sample Axis2 server (go to + samples/axis2Server/src/LoadbalanceFailoverService and run 'ant') + </li> + +<li> + Start 3 instances of the Axis2 server on different ports as follows + +<div class="command">./axis2server.sh -http 9001 -https 9005 -name MyServer1<br /> +./axis2server.sh -http 9002 -https 9006 -name MyServer2<br /> +./axis2server.sh -http 9003 -https 9007 -name MyServer3</div> + </li> + +<li> + Start Synapse using the configuration numbered 52 (repository/conf/sample/synapse_sample_52.xml) + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 52<br /> + Windows: synapse.bat -sample 52 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + Invoke the sample client as follows + </p> + +<div class="command">ant loadbalancefailover -Di=100</div> + +<p> + This will send 100 requests to the LoadbalanceFailoverService through Synapse. + Synapse will distribute the load among the three endpoints mentioned in the + configuration in round-robin manner. LoadbalanceFailoverService appends the name + of the server to the response, so that client can determine which server has + processed the message. If you examine the console output of the client, you can + see that requests are processed by three servers as follows: + </p> + +<div class="consoleOutput">[java] Request: 1 ==> Response from server: MyServer1 +[java] Request: 2 ==> Response from server: MyServer2 +[java] Request: 3 ==> Response from server: MyServer3 +[java] Request: 4 ==> Response from server: MyServer1 +[java] Request: 5 ==> Response from server: MyServer2 +[java] Request: 6 ==> Response from server: MyServer3 +[java] Request: 7 ==> Response from server: MyServer1 +...</div> + +<p> + Now run the client without the -Di=100 parameter to send requests indefinitely. + While running the client shutdown the server named MyServer1. Then you can observe + that requests are only distributed among MyServer2 and MyServer3. Console output + before and after shutting down MyServer1 is listed below (MyServer1 was shutdown + after request 63): + </p> + +<div class="consoleOutput">... +[java] Request: 61 ==> Response from server: MyServer1 +[java] Request: 62 ==> Response from server: MyServer2 +[java] Request: 63 ==> Response from server: MyServer3 +[java] Request: 64 ==> Response from server: MyServer2 +[java] Request: 65 ==> Response from server: MyServer3 +[java] Request: 66 ==> Response from server: MyServer2 +[java] Request: 67 ==> Response from server: MyServer3 +...</div> + +<p> + Now restart MyServer1. You can observe that requests will be again sent to all + three servers. + </p> + </div> + </div> + +<p><a href="../samples.html">Back to Catalog</a></p> + + + </div> + </div> + </div> + <hr/> + <footer> + <div class="container-fluid"> + <div class="row-fluid"> + <p>Copyright ©2005–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html> Added: synapse/site/3_0_1/userguide/samples/sample59.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample59.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample59.html (added) +++ synapse/site/3_0_1/userguide/samples/sample59.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,232 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-04 + | Rendered using Apache Maven Fluido Skin 1.6 +--> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="Date-Revision-yyyymmdd" content="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 59</title> + <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" /> + <link rel="stylesheet" href="../../css/site.css" /> + <link rel="stylesheet" href="../../css/print.css" media="print" /> + <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script> + </head> + <body class="topBarDisabled"> + <div class="container-fluid"> + <div id="banner"> + <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2> +</div> +</div> + <div class="pull-right"></div> + <div class="clear"><hr/></div> + </div> + + <div id="breadcrumbs"> + <ul class="breadcrumb"> + <li id="publishDate">Last Published: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</li> + </ul> + </div> + <div class="row-fluid"> + <div id="leftColumn" class="span2"> + <div class="well sidebar-nav"> +<ul class="nav nav-list"> + <li class="nav-header">Main Menu</li> + <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li> + <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li> + <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li> + <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li> + <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li> + <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li> + <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li> + <li class="nav-header">Documentation</li> + <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li> + <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li> + <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li> + <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li> + <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li> + <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li> + <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li> + <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li> + <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li> + <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li> + <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li> + <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li> + <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li> + <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li> + <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li> + <li class="nav-header">Developer Resources</li> + <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li> + <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li> + <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li> + <li class="nav-header">Project Details</li> + <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li> + <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li> + <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li> + <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li> + <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li> + <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li> + </ul> + <hr /> + <div id="poweredBy"> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <div class="clear"></div> + <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a> + </div> + </div> + </div> + <div id="bodyColumn" class="span10" > + + + <div class="section"> +<h2><a name="Sample_59:_Weighted_Round-Robin_loadbalancing_between_3_endpoints"></a>Sample 59: Weighted Round-Robin loadbalancing between 3 endpoints</h2> + +<div class="xmlConf"><?xml version="1.0" encoding="UTF-8"?> +<definitions xmlns="http://ws.apache.org/ns/synapse"> + <sequence name="main" onError="errorHandler"> + <in> + <send> + <endpoint> + <loadbalance + algorithm="org.apache.synapse.endpoints.algorithms.WeightedRoundRobin"> + <endpoint> + <address uri="http://localhost:9001/services/LBService1"> + <enableAddressing/> + <suspendOnFailure> + <initialDuration>20000</initialDuration> + <progressionFactor>1.0</progressionFactor> + </suspendOnFailure> + </address> + <property name="loadbalance.weight" value="1"/> + </endpoint> + <endpoint> + <address uri="http://localhost:9002/services/LBService1"> + <enableAddressing/> + <suspendOnFailure> + <initialDuration>20000</initialDuration> + <progressionFactor>1.0</progressionFactor> + </suspendOnFailure> + </address> + <property name="loadbalance.weight" value="2"/> + </endpoint> + <endpoint> + <address uri="http://localhost:9003/services/LBService1"> + <enableAddressing/> + <suspendOnFailure> + <initialDuration>20000</initialDuration> + <progressionFactor>1.0</progressionFactor> + </suspendOnFailure> + </address> + <property name="loadbalance.weight" value="3"/> + </endpoint> + </loadbalance> + </endpoint> + </send> + <drop/> + </in> + <out> + <send/> + </out> + </sequence> + <sequence name="errorHandler"> + <makefault response="true"> + <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/> + <reason value="COULDN'T SEND THE MESSAGE TO THE SERVER."/> + </makefault> + <send/> + </sequence> +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Objective: Demonstrate the weighted load balancing among a set of +endpoints + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li>Start ESB with sample configuration 59. (i.e. wso2esb-samples -sn 59) </li> + + +<li>Deploy the LoadbalanceFailoverService and start three instances of sample Axis2 server as mentioned in sample 52.</li> + + +<li>Above configuration sends messages with the weighted loadbalance behaviour. Weight of each leaf + address endpoint is defined by integer value of "loadbalance.weight" property associated with each endpoint. + If weight of a endpoint is x, x number of requests will send to that endpoint before switch to next active endpoint. + <br />To test this, run the loadbalancefailover client to send 100 requests as follows: </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + Invoke the sample client as follows + </p> + +<div class="command">ant loadbalancefailover -Di=100</div> + +<p>This client sends 100 requests to the LoadbalanceFailoverService through + ESB. ESB will distribute the load among the three endpoints mentioned in the + configuration in weighted round-robin manner. LoadbalanceFailoverService appends the + name of the server to the response, so that client can determine which server + has processed the message. If you examine the console output of the client, + you can see that requests are processed by three servers as follows: </p> + +<div class="consoleOutput">[java] Request: 1 ==> Response from server: MyServer1 + [java] Request: 2 ==> Response from server: MyServer2 + [java] Request: 3 ==> Response from server: MyServer2 + [java] Request: 4 ==> Response from server: MyServer3 + [java] Request: 5 ==> Response from server: MyServer3 + [java] Request: 6 ==> Response from server: MyServer3 + [java] Request: 7 ==> Response from server: MyServer1 + [java] Request: 8 ==> Response from server: MyServer2 + [java] Request: 9 ==> Response from server: MyServer2 + [java] Request: 10 ==> Response from server: MyServer3 + [java] Request: 11 ==> Response from server: MyServer3 + [java] Request: 12 ==> Response from server: MyServer3 + ... + </div> + +<p>As logs, endpoint with weight 1 received a 1 request and endpoint with weight 2 received 2 + requests and etc... in a cycle</p> + </div> + </div> + +<p> + <a href="../samples.html">Back to Catalog</a> + </p> + + + </div> + </div> + </div> + <hr/> + <footer> + <div class="container-fluid"> + <div class="row-fluid"> + <p>Copyright ©2005–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html>
