You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by na...@apache.org on 2021/03/31 16:45:52 UTC

[ignite] branch master updated: IGNITE-14398 Document thin client support for spring-data integration. (#8941)

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

namelchev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new ec89c85  IGNITE-14398 Document thin client support for spring-data integration. (#8941)
ec89c85 is described below

commit ec89c8586df89899ae56ebbc598639e0afea5901
Author: Mikhail Petrov <32...@users.noreply.github.com>
AuthorDate: Wed Mar 31 19:45:38 2021 +0300

    IGNITE-14398 Document thin client support for spring-data integration. (#8941)
---
 .../spring/spring-data.adoc                        | 64 ++++++++++++++++++++--
 1 file changed, 58 insertions(+), 6 deletions(-)

diff --git a/docs/_docs/extensions-and-integrations/spring/spring-data.adoc b/docs/_docs/extensions-and-integrations/spring/spring-data.adoc
index 8216a59..b2ba3d0 100644
--- a/docs/_docs/extensions-and-integrations/spring/spring-data.adoc
+++ b/docs/_docs/extensions-and-integrations/spring/spring-data.adoc
@@ -22,8 +22,8 @@ database to another with minimal efforts. Apache Ignite integrates with Spring D
 
 == Maven Configuration
 
-The easiest way to start working with Apache Ignite's Spring Data repository is by adding the following Maven dependency
-to an application's `pom.xml` file:
+The easiest way to start working with Apache Ignite's Spring Data repository is by adding the following Maven dependencies
+to the application's `pom.xml` file:
 
 [tabs]
 --
@@ -33,11 +33,39 @@ tab:pom.xml[]
 <dependency>
     <groupId>org.apache.ignite</groupId>
     <artifactId>ignite-spring-data_2.2</artifactId>
-    <version>{ignite.version}</version>
+    <version>${ignite-spring-data-ext.version}</version>
+</dependency>
+
+<dependency>
+    <groupId>org.apache.ignite</groupId>
+    <artifactId>ignite-core</artifactId>
+    <version>${ignite.version}</version>
+</dependency>
+
+<dependency>
+    <groupId>org.apache.ignite</groupId>
+    <artifactId>ignite-indexing</artifactId>
+    <version>${ignite.version}</version>
+</dependency>
+
+<dependency>
+    <groupId>org.apache.ignite</groupId>
+    <artifactId>ignite-spring</artifactId>
+    <version>${ignite.version}</version>
+</dependency>
+
+<dependency>
+    <groupId>org.springframework.data</groupId>
+    <artifactId>spring-data-commons</artifactId>
+    <version>${spring.data.version}</version>
 </dependency>
 ----
 --
 
+Replace `${ignite-spring-data-ext.version}`, `${spring.data.version}`, and
+`${ignite.version}` with an actual version of Apache Ignite Spring Data extension, Spring Data, and Apache Ignite
+dependencies you are interested in, respectively.
+
 [NOTE]
 ====
 If your Spring Data version is earlier than Spring Data 2.2 then set `ignite-spring-data_2.0`
@@ -113,13 +141,17 @@ Instead of these operations you can use Ignite specific counterparts available v
 
 == Spring Data and Apache Ignite Configuration
 
+Apache Ignite Spring Data integration supports connecting to the Apache Ignite cluster through the Apache Ignite node or
+Apache Ignite thin client. Both approaches to configuring access to the Apache Ignite cluster use the same API shown
+below. Apache Ignite Spring Data integration automatically recognizes the type of the provided bean and uses the
+appropriate cluster connection.
 
 To enable Apache Ignite backed repositories in Spring Data, mark an application configuration with `@EnableIgniteRepositories`
 annotation, as shown below:
 
 [tabs]
 --
-tab:Java[]
+tab:Ignite node connection configuration[]
 [source,java]
 ----
 @Configuration
@@ -152,10 +184,26 @@ public class SpringAppCfg {
     }
 }
 ----
+tab:Ignite thin client connection configuration[]
+[source,java]
+----
+@Configuration
+@EnableIgniteRepositories
+public class SpringAppCfg {
+    /**
+     * Creating Apache Ignite thin client instance bean. A bean will be passed to the IgniteRepositoryFactoryBean to
+     * connect to the Ignite cluster and perform cache operations.
+     */
+    @Bean
+    public IgniteClient igniteInstance() {
+        return Ignition.startClient(new ClientConfiguration().setAddresses("127.0.0.1:10800");;
+    }
+}
+----
 --
 
-The configuration has to instantiate Apache Ignite bean (node) that will be passed to `IgniteRepositoryFactoryBean`
-and will be used by all the Apache Ignite repositories in order to connect to the cluster.
+The configuration has to instantiate the Apache Ignite bean (node) or the Apache Ignite thin client bean that is passed
+to `IgniteRepositoryFactoryBean` and is used by all the Apache Ignite repositories in order to connect to the cluster.
 
 In the example above, the bean is initialized directly by the application and is named `igniteInstance`.
 Alternatively, the following beans can be registered in your configuration and an Apache Ignite node will be started automatically:
@@ -163,6 +211,10 @@ Alternatively, the following beans can be registered in your configuration and a
 * `IgniteConfiguration` object named as `igniteCfg` bean.
 * A path to Apache Ignite's Spring XML configuration named `igniteSpringCfgPath`.
 
+In the case of connecting to the cluster via Apache Ignite thin client, you can alternatively register the
+`ClientConfiguration` bean named `igniteCfg`, so that the Apache Ignite thin client instance is started automatically by
+the Apache Ignite Spring Data integration.
+
 == Using Apache Ignite Repositories
 
 Once all the configurations and repositories are ready to be used, you can register the configuration in an application context and get a reference to the repository.