Some more description for the failover test and the test being updated.

Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a45b3d2e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a45b3d2e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a45b3d2e

Branch: refs/heads/ignite-7777
Commit: a45b3d2edf3464493b248f74031f55bc7f73a3c9
Parents: 3b8d7f9
Author: Pavel Petroshenko <[email protected]>
Authored: Wed Jun 20 17:13:46 2018 +0300
Committer: Pavel Petroshenko <[email protected]>
Committed: Wed Jun 20 17:13:46 2018 +0300

----------------------------------------------------------------------
 .../platforms/nodejs/examples/FailoverExample.js    |  7 ++++++-
 modules/platforms/nodejs/examples/README.md         | 16 ++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a45b3d2e/modules/platforms/nodejs/examples/FailoverExample.js
----------------------------------------------------------------------
diff --git a/modules/platforms/nodejs/examples/FailoverExample.js 
b/modules/platforms/nodejs/examples/FailoverExample.js
index beb545b..25db544 100644
--- a/modules/platforms/nodejs/examples/FailoverExample.js
+++ b/modules/platforms/nodejs/examples/FailoverExample.js
@@ -18,6 +18,10 @@
 const IgniteClient = require('apache-ignite-client');
 const IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration;
 
+const ENDPOINT1 = 'localhost:10800';
+const ENDPOINT2 = 'localhost:10801';
+const ENDPOINT3 = 'localhost:10802';
+
 // This example demonstrates failover behavior of the client
 // - configures the client to connect to a set of nodes
 // - connects to a node
@@ -25,9 +29,10 @@ const IgniteClientConfiguration = 
IgniteClient.IgniteClientConfiguration;
 // - if no specified nodes are available, stops the client
 async function connectClient() {
     const igniteClient = new IgniteClient(onStateChanged);
+    igniteClient.setDebug(true);
     try {
         const igniteClientConfiguration = new IgniteClientConfiguration(
-            '127.0.0.1:10800', '127.0.0.1:10801', '127.0.0.1:10802');
+            ENDPOINT1, ENDPOINT2, ENDPOINT3);
         // connect to Ignite a node
         await igniteClient.connect(igniteClientConfiguration);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/a45b3d2e/modules/platforms/nodejs/examples/README.md
----------------------------------------------------------------------
diff --git a/modules/platforms/nodejs/examples/README.md 
b/modules/platforms/nodejs/examples/README.md
index 95552ca..c276953 100644
--- a/modules/platforms/nodejs/examples/README.md
+++ b/modules/platforms/nodejs/examples/README.md
@@ -108,3 +108,19 @@ Follow the [instructions in the main 
readme](../README.md#installation).
 6. If needed, modify `USER_NAME` and `PASSWORD` constants in the example 
source file. The default values are the default Ignite username/password.
 
 7. Executes [Setup and Running](#setup-and-running) steps.
+
+## Additional Setup for FailoverExample ##
+
+1. Run three Ignite nodes. See appropriate Ignite documentation for more 
details.
+
+2. If needed, modify `ENDPOINT1`, `ENDPOINT2`, `ENDPOINT2` constants in an 
example source file - Ignite node endpoints.
+Default values are `localhost:10800`, `localhost:10801`, `localhost:10802` 
respectively.
+
+2. Run an example by calling `node FailoverExample.js`. 
+
+3. Shut down the node the client connected to (you can find it out from the 
client logs in the console).
+
+4. From the logs, you will see that the client automatically reconnects to 
another node which is available.
+
+5. Shut down all the nodes. You will see the client being stopped after 
failing to connect to each of the nodes.
+

Reply via email to