This is an automated email from the ASF dual-hosted git repository.

dmagda pushed a commit to branch IGNITE-7595
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/IGNITE-7595 by this push:
     new c559232  IGNITE-13331 Document .NET thin client features implemented 
in 2.9 release (#8306)
c559232 is described below

commit c5592322b705be65fa49ce8e323b2463f23442a9
Author: Pavel Tupitsyn <ptupit...@apache.org>
AuthorDate: Fri Oct 2 22:23:30 2020 +0300

    IGNITE-13331 Document .NET thin client features implemented in 2.9 release 
(#8306)
    
    * Documentation for the compute and clustering APIs that appeared in the 
.NET thin client
---
 docs/_docs/code-snippets/dotnet/DataStreaming.cs |  2 +-
 docs/_docs/code-snippets/dotnet/SqlJoinOrder.cs  |  2 -
 docs/_docs/code-snippets/dotnet/ThinClient.cs    | 52 ++++++++++++-
 docs/_docs/code-snippets/dotnet/dotnet.csproj    | 11 +++
 docs/_docs/thin-clients/dotnet-thin-client.adoc  | 95 +++++++++++++++++++++---
 5 files changed, 146 insertions(+), 16 deletions(-)

diff --git a/docs/_docs/code-snippets/dotnet/DataStreaming.cs 
b/docs/_docs/code-snippets/dotnet/DataStreaming.cs
index 1d10182..a03b04a 100644
--- a/docs/_docs/code-snippets/dotnet/DataStreaming.cs
+++ b/docs/_docs/code-snippets/dotnet/DataStreaming.cs
@@ -15,7 +15,7 @@ namespace dotnet_helloworld
 
         public static void DataStreamerExample()
         {
-            using (var ignite = Ignition.Start(Util.getIngiteCfg()))
+            using (var ignite = Ignition.Start())
             {
                 ignite.GetOrCreateCache<int, string>("myCache");
                 //tag::dataStreamer1[]
diff --git a/docs/_docs/code-snippets/dotnet/SqlJoinOrder.cs 
b/docs/_docs/code-snippets/dotnet/SqlJoinOrder.cs
index 878e650..16fc870 100644
--- a/docs/_docs/code-snippets/dotnet/SqlJoinOrder.cs
+++ b/docs/_docs/code-snippets/dotnet/SqlJoinOrder.cs
@@ -5,8 +5,6 @@ namespace dotnet_helloworld
     using System;
     using System.Collections.Generic;
     using Apache.Ignite.Core;
-    using GridGain.Core;
-    using GridGain.Core.Security;
 
     public static class SqlJoinOrder
     {
diff --git a/docs/_docs/code-snippets/dotnet/ThinClient.cs 
b/docs/_docs/code-snippets/dotnet/ThinClient.cs
index f92172d..06d4579 100644
--- a/docs/_docs/code-snippets/dotnet/ThinClient.cs
+++ b/docs/_docs/code-snippets/dotnet/ThinClient.cs
@@ -8,6 +8,7 @@ using Apache.Ignite.Core.Cache.Configuration;
 using Apache.Ignite.Core.Cache.Query;
 using Apache.Ignite.Core.Client;
 using Apache.Ignite.Core.Client.Cache;
+using Apache.Ignite.Core.Client.Compute;
 using Apache.Ignite.Core.Configuration;
 using Apache.Ignite.Core.Log;
 
@@ -95,7 +96,7 @@ namespace dotnet_helloworld
 
         public static void ScanQueryFilterDemo()
         {
-            using (var ignite = Ignition.Start(Util.getIngiteCfg()))
+            using (var ignite = Ignition.Start())
             {
                 var cfg = new IgniteClientConfiguration
                 {
@@ -158,7 +159,7 @@ namespace dotnet_helloworld
 
         public static void ExecutingSql()
         {
-            using (var ignite = Ignition.Start(Util.getIngiteCfg()))
+            using (var ignite = Ignition.Start())
             {
                 var cfg = new IgniteClientConfiguration
                 {
@@ -283,5 +284,52 @@ namespace dotnet_helloworld
             }
             //end::discovery[]
         }
+
+        public static void ClientCluster()
+        {
+            var cfg = new IgniteClientConfiguration();
+            //tag::client-cluster[]
+            IIgniteClient client = Ignition.StartClient(cfg);
+            IClientCluster cluster = client.GetCluster();
+            cluster.SetActive(true);
+            cluster.EnableWal("my-cache");
+            //end::client-cluster[]
+        }
+
+        public static void ClientClusterGroups()
+        {
+            var cfg = new IgniteClientConfiguration();
+            //tag::client-cluster-groups[]
+            IIgniteClient client = Ignition.StartClient(cfg);
+            IClientClusterGroup serversInDc1 = 
client.GetCluster().ForServers().ForAttribute("dc", "dc1");
+            foreach (IClientClusterNode node in serversInDc1.GetNodes())
+                Console.WriteLine($"Node ID: {node.Id}");
+            //end::client-cluster-groups[]
+        }
+
+        public static void Compute()
+        {
+            //tag::client-compute-setup[]
+            var igniteCfg = new IgniteConfiguration
+            {
+                ClientConnectorConfiguration = new ClientConnectorConfiguration
+                {
+                    ThinClientConfiguration = new ThinClientConfiguration
+                    {
+                        MaxActiveComputeTasksPerConnection = 10
+                    }
+                }
+            };
+
+            IIgnite ignite = Ignition.Start(igniteCfg);
+            //end::client-compute-setup[]
+
+            var cfg = new IgniteClientConfiguration();
+            //tag::client-compute-task[]
+            IIgniteClient client = Ignition.StartClient(cfg);
+            IComputeClient compute = client.GetCompute();
+            int result = 
compute.ExecuteJavaTask<int>("org.foo.bar.AddOneTask", 1);
+            //end::client-compute-task[]
+        }
     }
 }
diff --git a/docs/_docs/code-snippets/dotnet/dotnet.csproj 
b/docs/_docs/code-snippets/dotnet/dotnet.csproj
new file mode 100644
index 0000000..14f8fa3
--- /dev/null
+++ b/docs/_docs/code-snippets/dotnet/dotnet.csproj
@@ -0,0 +1,11 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>netcoreapp2.0</TargetFramework>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Apache.Ignite" Version="2.9.0-alpha20201001" />
+  </ItemGroup>
+
+</Project>
diff --git a/docs/_docs/thin-clients/dotnet-thin-client.adoc 
b/docs/_docs/thin-clients/dotnet-thin-client.adoc
index 07cba4f..1acc02c 100644
--- a/docs/_docs/thin-clients/dotnet-thin-client.adoc
+++ b/docs/_docs/thin-clients/dotnet-thin-client.adoc
@@ -1,5 +1,7 @@
 = .NET Thin Client
 
+:sourceCodeFile: code-snippets/dotnet/ThinClient.cs
+
 == Prerequisites
 - Supported runtimes: .NET 4.0+, .NET Core 2.0+
 - Supported OS: Windows, Linux, macOS (any OS supported by .NET Core 2.0+)
@@ -16,7 +18,7 @@ The `IgniteClientConfiguration.Endpoints` property is 
mandatory; it must point t
 
 [source, csharp]
 ----
-include::code-snippets/dotnet/ThinClient.cs[tag=connecting,indent=0]
+include::{sourceCodeFile}[tag=connecting,indent=0]
 ----
 
 === Failover
@@ -38,7 +40,7 @@ You can observe the discovery process by enabling logging 
and/or calling `IIgnit
 
 [source, csharp]
 ----
-include::code-snippets/dotnet/ThinClient.cs[tag=discovery,indent=0]
+include::{sourceCodeFile}[tag=discovery,indent=0]
 ----
 
 [WARNING]
@@ -90,17 +92,17 @@ The `ICacheClient` interface provides the key-value API. 
You can use the followi
 
 [source, csharp]
 ----
-include::code-snippets/dotnet/ThinClient.cs[tag=createCache,indent=0]
+include::{sourceCodeFile}[tag=createCache,indent=0]
 ----
 
-Use `IIgnite​Client.GetCacheNames()` to obtain a list of all existing caches.
+Use `IIgniteClient.GetCacheNames()` to obtain a list of all existing caches.
 
 === Basic Operations
 The following code snippet demonstrates how to execute basic cache operations 
on a specific cache.
 
 [source, csharp]
 ----
-include::code-snippets/dotnet/ThinClient.cs[tag=basicOperations,indent=0]
+include::{sourceCodeFile}[tag=basicOperations,indent=0]
 ----
 
 ////
@@ -113,7 +115,7 @@ The .NET thin client supports the Binary Object API 
described in the link:key-va
 
 [source, csharp]
 ----
-include::code-snippets/dotnet/ThinClient.cs[tag=binaryObj,indent=0]
+include::{sourceCodeFile}[tag=binaryObj,indent=0]
 ----
 
 == Scan Queries
@@ -125,13 +127,13 @@ The query condition is specified by an 
`ICacheEntryFilter` object that is passed
 Define a query filter as follows:
 [source, csharp]
 ----
-include::code-snippets/dotnet/ThinClient.cs[tag=scanQry,indent=0]
+include::{sourceCodeFile}[tag=scanQry,indent=0]
 ----
 
 Then execute the scan query:
 [source, csharp]
 ----
-include::code-snippets/dotnet/ThinClient.cs[tag=scanQry2,indent=0]
+include::{sourceCodeFile}[tag=scanQry2,indent=0]
 ----
 
 
@@ -142,8 +144,79 @@ Alternatively, SQL queries can be performed via Ignite 
LINQ provider.
 
 [source, csharp]
 ----
-include::code-snippets/dotnet/ThinClient.cs[tag=executingSql,indent=0]
+include::{sourceCodeFile}[tag=executingSql,indent=0]
+----
+
+
+== Cluster API
+
+Cluster functionality (APIs for accessing cluster and nodes) is provided via 
the `IClientCluster` interface.
+You can get an instance of `IClientCluster` from `IIgniteClient` as follows:
+[source, csharp]
+-------------------------------------------------------------------------------
+include::{sourceCodeFile}[tag=client-cluster,indent=0]
+-------------------------------------------------------------------------------
+
+Through the `IClientCluster` interface you can:
+
+* Get or set cluster state
+* Get a list of all cluster members
+* Create logical groups of nodes
+
+=== Logical nodes grouping
+
+API to create logical groups of nodes within your cluster is provided by 
`IClientClusterGroup` interface.
+Instance of this interface can be obtained from a parent `IClientClusterGroup` 
instance using node-filtering methods.
+
+The `IClientCluster` instance implements `IClientClusterGroup` and is a root 
cluster group, which includes all nodes in the cluster.
+
+Here is how you can use this API to get all server nodes in certain 
data-center (assuming node attribute "dc" is set to bind node and data-center):
+[source, csharp]
+-------------------------------------------------------------------------------
+include::{sourceCodeFile}[tag=client-cluster-groups,indent=0]
+-------------------------------------------------------------------------------
+
+Refer to link:distributed-computing/cluster-groups[Cluster groups] to get more 
information about logical nodes grouping.
+
+
+== Executing compute tasks
+
+Thin client has basic functionality to execute compute tasks. This feature is 
disabled by default on the server side.
+Set `ThinClientConfiguration.MaxActiveComputeTasksPerConnection` to a non-zero 
value to enable:
+
+[tabs]
+--
+tab:Spring XML[]
+[source,xml]
+----
+<bean class="org.apache.ignite.configuration.IgniteConfiguration" 
id="ignite.cfg">
+  <property name="clientConnectorConfiguration">
+    <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
+      <property name="thinClientConfiguration">
+        <bean class="org.apache.ignite.configuration.ThinClientConfiguration">
+          <property name="maxActiveComputeTasksPerConnection" value="100" />
+        </bean>
+      </property>
+    </bean>
+  </property>
+</bean>
+----
+tab:C#[]
+[source,csharp]
+----
+include::{sourceCodeFile}[tag=client-compute-setup,indent=0]
 ----
+--
+
+Compute functionality is provided by `IComputeClient` interface, which can be 
obtained from `IIgniteClient` instance.
+
+Currently, thin clients can run already deployed tasks by class name. Task 
classes should be depoyed in advance to the server nodes.
+[source, java]
+-------------------------------------------------------------------------------
+include::{sourceCodeFile}[tag=client-compute-task,indent=0]
+-------------------------------------------------------------------------------
+
+See link:distributed-computing/distributed-computing[distributed computing] 
for more information about compute grid functionality.
 
 
 == Security
@@ -155,7 +228,7 @@ To use encrypted communication between the thin client and 
the cluster, you have
 The following code example demonstrates how to configure SSL parameters in the 
thin client.
 [source, csharp]
 ----
-include::code-snippets/dotnet/ThinClient.cs[tag=ssl,indent=0]
+include::{sourceCodeFile}[tag=ssl,indent=0]
 ----
 
 
@@ -166,6 +239,6 @@ Configure link:security/authentication[authentication on 
the cluster side] and p
 
 [source, csharp]
 ----
-include::code-snippets/dotnet/ThinClient.cs[tag=auth,indent=0]
+include::{sourceCodeFile}[tag=auth,indent=0]
 ----
 

Reply via email to