From 313bce0bd3985a0876ecf1b625eba1ef977c6a04 Mon Sep 17 00:00:00 2001 From: Dave Barnes Date: Tue, 1 Jun 2021 12:49:18 -0700 Subject: [PATCH 1/5] GEODE-9165: User Guide - Add "getting started with clients" --- .../source/subnavs/geode-subnav.erb | 3 + .../getting_started/book_intro.html.md.erb | 3 + .../intro_to_clients.html.md.erb | 353 ++++++++++++++++++ 3 files changed, 359 insertions(+) create mode 100644 geode-docs/getting_started/intro_to_clients.html.md.erb diff --git a/geode-book/master_middleman/source/subnavs/geode-subnav.erb b/geode-book/master_middleman/source/subnavs/geode-subnav.erb index 9c49392740eb..7f261e1f535c 100644 --- a/geode-book/master_middleman/source/subnavs/geode-subnav.erb +++ b/geode-book/master_middleman/source/subnavs/geode-subnav.erb @@ -69,6 +69,9 @@ limitations under the License.
  • Apache Geode in 15 Minutes or Less
  • +
  • + Introduction to <%=vars.product_name%> Clients +
  • diff --git a/geode-docs/getting_started/book_intro.html.md.erb b/geode-docs/getting_started/book_intro.html.md.erb index ef92bdc72427..c0f5f1c7dfcf 100644 --- a/geode-docs/getting_started/book_intro.html.md.erb +++ b/geode-docs/getting_started/book_intro.html.md.erb @@ -37,4 +37,7 @@ A tutorial demonstrates features, and a main features section describes key func Need a quick introduction to <%=vars.product_name_long%>? Take this brief tour to try out basic features and functionality. +- **[Introduction to <%=vars.product_name%> Clients](intro_to_clients.html)** + + Basic starting points for a variety of <%=vars.product_name %> clients. diff --git a/geode-docs/getting_started/intro_to_clients.html.md.erb b/geode-docs/getting_started/intro_to_clients.html.md.erb new file mode 100644 index 000000000000..8d91d62ac66c --- /dev/null +++ b/geode-docs/getting_started/intro_to_clients.html.md.erb @@ -0,0 +1,353 @@ + + +<% set_title("Introduction to", product_name, "Clients") %> + +This section provides basic starting points for a variety of <%=vars.product_name %> clients, along +with very rudimentary connect, put, get, and then a reference to more in-depth docs and examples on +how to use the client. + +## Installing Apache Geode + +You can download Apache Geode from the website, run a Docker image, or install with homebrew on OSX. + +## Start an Apache Geode Cluster + +With a path that contains the bin directory of the installation, start a locator and server. + +``` +$ gfsh +gfsh> start locator +gfsh> start server +``` + +Create a region + +``` +gfsh> create region --name=helloWorld --type=PARTITION +``` + +Shutting Down Apache Geode + +``` +gfsh> shutdown --include-locators=true +``` + +## Apache Geode Java Client + +**Maven Dependencies** + +Declare the following dependency and replace $VERSION, with the version of Geode that you have installed. + +``` + + + org.apache.geode + geode-core + $VERSION + + +``` + +**Gradle Dependencies** + +`` +dependencies { + compile "org.apache.geode:geode-core:$VERSION" +} +`` + +Connect to Geode from your application + +``` +import org.apache.geode.cache.client.ClientCache; +import org.apache.geode.cache.client.ClientCacheFactory; + +public class HelloWorld { + + public static void main(String[] args) { + ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334).create(); + + System.out.println(cache.getDefaultPool().getLocators()); + +cache.close(); + } +} +``` + +The information printed out should match the host and port of your Geode instance locators and should resemble + +``` +[/127.0.0.1:10334] +``` + +### Simple Put and Get with Geode Java client + +``` +public static void main(String[] args) { +ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334).create(); + + Region + helloWorldRegion = + cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create("helloWorld"); + + helloWorldRegion.put("1", "HelloWorldValue"); + String value1 = helloWorldRegion.get("1"); + System.out.println(value1); + + cache.close(); +} +``` + +Build and run the application. This puts the key ‘1’ with a value of ‘HelloWorldValue’ into the +‘helloWorld’ region, then retrieves and prints the value of key ‘1’. + +### Additional Resources + +- [Apache Geode Examples GitHub Repo](https://github.com/apache/geode-examples) +- [Apache Geode Documentation](https://geode.apache.org/docs/) +- [Apache Geode Javadocs](https://geode.apache.org/releases/latest/javadoc/index.html) + +## Spring Boot Client For Apache Geode + +Spring Boot for Apache Geode provides a powerful abstraction that simplifies the developer +experience when using Spring Boot and Apache Geode. The best way to get started with Spring Boot +for Apache Geode, is by creating a project on start.spring.io. + +Add the ‘Spring for Apache Geode’ dependency and then select either ‘Generate’, which creates a zip +file to import into your IDE or ‘Explore’, which opens a build file based on your Project selection +(Maven or Gradle) + +**Maven Dependencies** + +Your Maven pom.xml file should include something similar to + +``` + + ... + 1.4.3 + + + + org.springframework.geode + spring-geode-starter + +… + + + + + + org.springframework.geode + spring-geode-bom + ${spring-geode.version} + pom + import + + + +``` + +**Gradle Dependencies** + +Your Gradle gradle.build file should include something similar to + +``` +ext { + set('springGeodeVersion', "1.4.3") +} + +dependencies { + implementation 'org.springframework.geode:spring-geode-starter' + testImplementation 'org.springframework.boot:spring-boot-starter-test' +} +dependencyManagement { + imports { + mavenBom "org.springframework.geode:spring-geode-bom:${springGeodeVersion}" + } +} +``` + +- Connect to Geode from your application +- Open your web browser to start.spring.io. + +- Click ‘Add Dependencies’. Search for the ‘Spring for Apache Geode’ dependency and add it to your project. Select ‘Generate’, which creates a zip file. Import this file into your IDE. + +- With your Geode cluster running, build and run the application (without making any other changes). + +- In the console output, you should see something similar to (starting with Spring Boot for Apache Geode v1.4.2+) + +``` +2021-03-19 11:27:14.532 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Successfully connected to localhost[40404] +2021-03-19 11:27:14.537 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Successfully connected to localhost[10334] +2021-03-19 11:27:14.538 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Cluster was found; Auto-configuration made [2] successful connection(s) +2021-03-19 11:27:14.538 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Spring Boot application is running in a client/server topology using a standalone Apache Geode-based cluster +``` + +This confirms that without adding any additional code, the application was able to connect to our Geode Cluster. + +### Building an Application with Spring Boot for Apache Geode. + +Spring Boot for Apache Geode is very powerful and robust. We recommend looking at the Spring Boot for Apache Geode documentation and examples for your next steps in working with this dependency. + +### Additional Resources + +- [Spring Boot for Apache Geode Reference Guide](https://docs.spring.io/spring-boot-data-geode-build/1.4.x/reference/html5/) + +## Apache Geode Native Clients + +To begin using the Apache Geode Native Clients, you must first build the Apache Geode Native Client libraries from the source code. +You can download the Apache Geode Native Source code here +`https://geode.apache.org/releases`, then follow the [BUILDING.md](https://github.com/apache/geode-native/blob/develop/BUILDING.md) instructions to compile the libraries. + + +## Apache Geode Native .NET Client + +**Put, Get and Remove with Apache Geode Native .NET Client (C#)** + +``` +using System; +using Apache.Geode.Client; + +namespace Apache.Geode.Examples.PutGetRemove +{ + class Program + { + static void Main(string[] args) + { + var cache = new CacheFactory() + .Set("log-level", "none") + .Create(); + + cache.GetPoolManager() + .CreateFactory() + .AddLocator("localhost", 10334) + .Create("pool"); + + var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY) + .SetPoolName("pool"); + var region = regionFactory.Create("example_userinfo"); + + Console.WriteLine("Storing id and username in the region"); + + const string rtimmonsKey = "rtimmons"; + const string rtimmonsValue = "Robert Timmons"; + const string scharlesKey = "scharles"; + const string scharlesValue = "Sylvia Charles"; + + region.Put(rtimmonsKey, rtimmonsValue); + region.Put(scharlesKey, scharlesValue); + + Console.WriteLine("Getting the user info from the region"); + var user1 = region.Get(rtimmonsKey, null); + var user2 = region.Get(scharlesKey, null); + + Console.WriteLine(rtimmonsKey + " = " + user1); + Console.WriteLine(scharlesKey + " = " + user2); + + Console.WriteLine("Removing " + rtimmonsKey + " info from the region"); + + if (region.Remove(rtimmonsKey)) + { + Console.WriteLine("Info for " + rtimmonsKey + " has been deleted"); + } + else + { + Console.WriteLine("Info for " + rtimmonsKey + " has not been deleted"); + } + + cache.Close(); + } + } +} +``` + +### Additional Resources + +- [Apache Geode Native Client Examples GitHub Repo](https://github.com/apache/geode-native/tree/develop/examples) +- [Apache Geode Native .NET Client Documentation](https://geode.apache.org/docs/) +- [Apache Geode Native Client .NET API Reference](https://geode.apache.org/releases/latest/dotnetdocs/hierarchy.html) + + +## Apache Geode Native C++ Client + +**Put, Get, and Remove with Apache Geode Native C++ Client** + +``` +#include + +#include +#include +#include +#include + +using namespace apache::geode::client; + +int main(int argc, char** argv) { + auto cache = CacheFactory() + .set("log-level", "none") + .create(); + + cache.getPoolManager() + .createFactory() + .addLocator("localhost", 10334) + .create("pool"); + + auto regionFactory = cache.createRegionFactory(RegionShortcut::PROXY); + auto region = regionFactory.setPoolName("pool").create("example_userinfo"); + + std::cout << "Storing id and username in the region" << std::endl; + region->put("rtimmons", "Robert Timmons"); + region->put("scharles", "Sylvia Charles"); + + std::cout << "Getting the user info from the region" << std::endl; + auto user1 = region->get("rtimmons"); + auto user2 = region->get("scharles"); + std::cout << " rtimmons = " + << std::dynamic_pointer_cast(user1)->value() + << std::endl; + std::cout << " scharles = " + << std::dynamic_pointer_cast(user2)->value() + << std::endl; + + std::cout << "Removing rtimmons info from the region" << std::endl; + region->remove("rtimmons"); + + if (region->existsValue("rtimmons")) { + std::cout << "rtimmons's info not deleted" << std::endl; + } else { + std::cout << "rtimmons's info successfully deleted" << std::endl; + } + + cache.close(); +} +``` + +### Additional Resources + +- [Apache Geode Native Client Examples GitHub Repo](https://github.com/apache/geode-native/tree/develop/examples) +- [Apache Geode Native C++ Client Documentation](https://geode.apache.org/docs/) +- [Apache Geode Native Client C++ API Reference](https://geode.apache.org/releases/latest/cppdocs/hierarchy.html) + +## Geode APIs Compatible with Redis + +The <%=vars.product_name%> APIs compatible with Redis allow <%=vars.product_name%> to function as a drop-in replacement for a +highly-available Redis data store, letting Redis applications take advantage of +<%=vars.product_name%>’s scaling capabilities without changing their client code. + +Note: This feature is experimental and is subject to change in future releases of Apache Geode. +See [Geode APIs compatible with Redis](../developing/geode_apis_compatible_with_redis.html) for current information regarding these APIs. From 598210ecd46ec5dee6380481d10bf981a2c2e873 Mon Sep 17 00:00:00 2001 From: Dave Barnes Date: Wed, 9 Jun 2021 15:27:40 -0700 Subject: [PATCH 2/5] Incorporate reviewer corrections --- .../intro_to_clients.html.md.erb | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/geode-docs/getting_started/intro_to_clients.html.md.erb b/geode-docs/getting_started/intro_to_clients.html.md.erb index 8d91d62ac66c..c627183fcc99 100644 --- a/geode-docs/getting_started/intro_to_clients.html.md.erb +++ b/geode-docs/getting_started/intro_to_clients.html.md.erb @@ -15,17 +15,18 @@ See the License for the specific language governing permissions and limitations under the License. --> -<% set_title("Introduction to", product_name, "Clients") %> +<% set_title("Introduction to", product_name_long, "Clients") %> -This section provides basic starting points for a variety of <%=vars.product_name %> clients, along +This section provides basic starting points for a variety of <%=vars.product_name_long %> clients, along with very rudimentary connect, put, get, and then a reference to more in-depth docs and examples on how to use the client. -## Installing Apache Geode +## Installing <%=vars.product_name_long%> -You can download Apache Geode from the website, run a Docker image, or install with homebrew on OSX. +You can download <%=vars.product_name_long%> from the website, run a Docker image, or install with homebrew on OSX. +See [How to Install Apache Geode](installation/install_standalone.html) for details. -## Start an Apache Geode Cluster +## Start an <%=vars.product_name_long%> Cluster With a path that contains the bin directory of the installation, start a locator and server. @@ -41,17 +42,17 @@ Create a region gfsh> create region --name=helloWorld --type=PARTITION ``` -Shutting Down Apache Geode +Shutting Down <%=vars.product_name_long%> ``` gfsh> shutdown --include-locators=true ``` -## Apache Geode Java Client +## <%=vars.product_name_long%> Java Client **Maven Dependencies** -Declare the following dependency and replace $VERSION, with the version of Geode that you have installed. +Declare the following dependency and replace $VERSION, with the version of <%=vars.product_name_long%> that you have installed. ``` @@ -71,7 +72,7 @@ dependencies { } `` -Connect to Geode from your application +Connect to the server from your application ``` import org.apache.geode.cache.client.ClientCache; @@ -89,13 +90,13 @@ cache.close(); } ``` -The information printed out should match the host and port of your Geode instance locators and should resemble +The information printed out should match the host and port of your <%=vars.product_name_long%> instance locators and should resemble ``` [/127.0.0.1:10334] ``` -### Simple Put and Get with Geode Java client +### Simple Put and Get with <%=vars.product_name_long%> Java client ``` public static void main(String[] args) { @@ -208,16 +209,16 @@ Spring Boot for Apache Geode is very powerful and robust. We recommend looking - [Spring Boot for Apache Geode Reference Guide](https://docs.spring.io/spring-boot-data-geode-build/1.4.x/reference/html5/) -## Apache Geode Native Clients +## <%=vars.product_name_long%> Native Clients -To begin using the Apache Geode Native Clients, you must first build the Apache Geode Native Client libraries from the source code. -You can download the Apache Geode Native Source code here -`https://geode.apache.org/releases`, then follow the [BUILDING.md](https://github.com/apache/geode-native/blob/develop/BUILDING.md) instructions to compile the libraries. +To begin using the <%=vars.product_name_long%> Native Clients, you must first build the <%=vars.product_name_long%> Native Client libraries from the source code. +You can download the <%=vars.product_name_long%> Native Source code here +`https://geode.apache.org/releases`, then refer to the `BUILDING.md]` file in the source release to compile the libraries. -## Apache Geode Native .NET Client +## <%=vars.product_name_long%> Native .NET Client -**Put, Get and Remove with Apache Geode Native .NET Client (C#)** +**Put, Get and Remove with <%=vars.product_name_long%> Native .NET Client (C#)** ``` using System; @@ -283,9 +284,9 @@ namespace Apache.Geode.Examples.PutGetRemove - [Apache Geode Native Client .NET API Reference](https://geode.apache.org/releases/latest/dotnetdocs/hierarchy.html) -## Apache Geode Native C++ Client +## <%=vars.product_name_long%> Native C++ Client -**Put, Get, and Remove with Apache Geode Native C++ Client** +**Put, Get, and Remove with <%=vars.product_name_long%> Native C++ Client** ``` #include @@ -345,9 +346,9 @@ int main(int argc, char** argv) { ## Geode APIs Compatible with Redis -The <%=vars.product_name%> APIs compatible with Redis allow <%=vars.product_name%> to function as a drop-in replacement for a +The <%=vars.product_name_long%> APIs compatible with Redis allow <%=vars.product_name_long%> to function as a drop-in replacement for a highly-available Redis data store, letting Redis applications take advantage of -<%=vars.product_name%>’s scaling capabilities without changing their client code. +<%=vars.product_name_long%>’s scaling capabilities without changing their client code. -Note: This feature is experimental and is subject to change in future releases of Apache Geode. +Note: This feature is experimental and is subject to change in future releases of <%=vars.product_name_long%>. See [Geode APIs compatible with Redis](../developing/geode_apis_compatible_with_redis.html) for current information regarding these APIs. From 024bdcebadef09dc7e313a3cd2f60334c4970b78 Mon Sep 17 00:00:00 2001 From: Dave Barnes Date: Thu, 10 Jun 2021 12:42:59 -0700 Subject: [PATCH 3/5] Incorporate reviewer corrections --- .../intro_to_clients.html.md.erb | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/geode-docs/getting_started/intro_to_clients.html.md.erb b/geode-docs/getting_started/intro_to_clients.html.md.erb index c627183fcc99..050522a80390 100644 --- a/geode-docs/getting_started/intro_to_clients.html.md.erb +++ b/geode-docs/getting_started/intro_to_clients.html.md.erb @@ -18,9 +18,11 @@ limitations under the License. <% set_title("Introduction to", product_name_long, "Clients") %> This section provides basic starting points for a variety of <%=vars.product_name_long %> clients, along -with very rudimentary connect, put, get, and then a reference to more in-depth docs and examples on +with very rudimentary connect, put, get operations, and then a reference to more in-depth docs and examples on how to use the client. +For an in-depth look at how to use <%=vars.product_name_long%> clients, see [Client/Server Configuration](../topologies_and_comm/cs_configuration/chapter_overview.html). + ## Installing <%=vars.product_name_long%> You can download <%=vars.product_name_long%> from the website, run a Docker image, or install with homebrew on OSX. @@ -28,7 +30,9 @@ See [How to Install Apache Geode](installation/install_standalone.html) for deta ## Start an <%=vars.product_name_long%> Cluster -With a path that contains the bin directory of the installation, start a locator and server. +For client tests and examples, start a simple cluster and create an example region. + +Start an <%=vars.product_name_long%> cluster with one locator and one server. ``` $ gfsh @@ -36,13 +40,13 @@ gfsh> start locator gfsh> start server ``` -Create a region +Create a region called "helloWorld". ``` gfsh> create region --name=helloWorld --type=PARTITION ``` -Shutting Down <%=vars.product_name_long%> +When you are through running client tests and examples, shut down the <%=vars.product_name_long%> cluster: ``` gfsh> shutdown --include-locators=true @@ -66,11 +70,11 @@ Declare the following dependency and replace $VERSION, with the version of <%=va **Gradle Dependencies** -`` +``` dependencies { compile "org.apache.geode:geode-core:$VERSION" } -`` +``` Connect to the server from your application @@ -80,12 +84,12 @@ import org.apache.geode.cache.client.ClientCacheFactory; public class HelloWorld { - public static void main(String[] args) { - ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334).create(); + public static void main(String[] args) { + ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334).create(); - System.out.println(cache.getDefaultPool().getLocators()); - -cache.close(); + System.out.println(cache.getDefaultPool().getLocators()); + + cache.close(); } } ``` @@ -120,14 +124,13 @@ Build and run the application. This puts the key ‘1’ with a value of ‘Hel ### Additional Resources - [Apache Geode Examples GitHub Repo](https://github.com/apache/geode-examples) -- [Apache Geode Documentation](https://geode.apache.org/docs/) - [Apache Geode Javadocs](https://geode.apache.org/releases/latest/javadoc/index.html) ## Spring Boot Client For Apache Geode Spring Boot for Apache Geode provides a powerful abstraction that simplifies the developer experience when using Spring Boot and Apache Geode. The best way to get started with Spring Boot -for Apache Geode, is by creating a project on start.spring.io. +for Apache Geode, is by creating a project using [Spring™ initializr](https://start.spring.io/). Add the ‘Spring for Apache Geode’ dependency and then select either ‘Generate’, which creates a zip file to import into your IDE or ‘Explore’, which opens a build file based on your Project selection @@ -183,21 +186,21 @@ dependencyManagement { } ``` -- Connect to Geode from your application -- Open your web browser to start.spring.io. +1. Connect to Geode from your application +2. Open your web browser to [Spring™ initializr](https://start.spring.io/). -- Click ‘Add Dependencies’. Search for the ‘Spring for Apache Geode’ dependency and add it to your project. Select ‘Generate’, which creates a zip file. Import this file into your IDE. +3. Click ‘Add Dependencies’. Search for the ‘Spring for Apache Geode’ dependency and add it to your project. Select ‘Generate’, which creates a zip file. Import this file into your IDE. -- With your Geode cluster running, build and run the application (without making any other changes). +4. With your Geode cluster running, build and run the application (without making any other changes). -- In the console output, you should see something similar to (starting with Spring Boot for Apache Geode v1.4.2+) +5. In the console output, you should see something similar to (starting with Spring Boot for Apache Geode v1.4.2+) -``` -2021-03-19 11:27:14.532 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Successfully connected to localhost[40404] -2021-03-19 11:27:14.537 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Successfully connected to localhost[10334] -2021-03-19 11:27:14.538 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Cluster was found; Auto-configuration made [2] successful connection(s) -2021-03-19 11:27:14.538 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Spring Boot application is running in a client/server topology using a standalone Apache Geode-based cluster -``` + ``` + 2021-03-19 11:27:14.532 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Successfully connected to localhost[40404] + 2021-03-19 11:27:14.537 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Successfully connected to localhost[10334] + 2021-03-19 11:27:14.538 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Cluster was found; Auto-configuration made [2] successful connection(s) + 2021-03-19 11:27:14.538 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Spring Boot application is running in a client/server topology using a standalone Apache Geode-based cluster + ``` This confirms that without adding any additional code, the application was able to connect to our Geode Cluster. From 620bfce277f4d17b1c68ae2a3cba4ef2dc9f5d1a Mon Sep 17 00:00:00 2001 From: Dave Barnes Date: Fri, 11 Jun 2021 09:29:20 -0700 Subject: [PATCH 4/5] Incorporate reviewer suggestions & corrections --- .../intro_to_clients.html.md.erb | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/geode-docs/getting_started/intro_to_clients.html.md.erb b/geode-docs/getting_started/intro_to_clients.html.md.erb index 050522a80390..35e79141e94d 100644 --- a/geode-docs/getting_started/intro_to_clients.html.md.erb +++ b/geode-docs/getting_started/intro_to_clients.html.md.erb @@ -23,12 +23,12 @@ how to use the client. For an in-depth look at how to use <%=vars.product_name_long%> clients, see [Client/Server Configuration](../topologies_and_comm/cs_configuration/chapter_overview.html). -## Installing <%=vars.product_name_long%> +## Installing <%=vars.product_name_long%> You can download <%=vars.product_name_long%> from the website, run a Docker image, or install with homebrew on OSX. See [How to Install Apache Geode](installation/install_standalone.html) for details. -## Start an <%=vars.product_name_long%> Cluster +## Starting an <%=vars.product_name_long%> Cluster For client tests and examples, start a simple cluster and create an example region. @@ -52,7 +52,7 @@ When you are through running client tests and examples, shut down the <%=vars.pr gfsh> shutdown --include-locators=true ``` -## <%=vars.product_name_long%> Java Client +## <%=vars.product_name_long%> Java Client **Maven Dependencies** @@ -85,11 +85,11 @@ import org.apache.geode.cache.client.ClientCacheFactory; public class HelloWorld { public static void main(String[] args) { - ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334).create(); + ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334).create(); - System.out.println(cache.getDefaultPool().getLocators()); + System.out.println(cache.getDefaultPool().getLocators()); - cache.close(); + cache.close(); } } ``` @@ -100,7 +100,7 @@ The information printed out should match the host and port of your <%=vars.produ [/127.0.0.1:10334] ``` -### Simple Put and Get with <%=vars.product_name_long%> Java client +**Simple Put and Get with <%=vars.product_name_long%> Java client** ``` public static void main(String[] args) { @@ -121,12 +121,12 @@ ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334). Build and run the application. This puts the key ‘1’ with a value of ‘HelloWorldValue’ into the ‘helloWorld’ region, then retrieves and prints the value of key ‘1’. -### Additional Resources +**Additional Resources** - [Apache Geode Examples GitHub Repo](https://github.com/apache/geode-examples) - [Apache Geode Javadocs](https://geode.apache.org/releases/latest/javadoc/index.html) -## Spring Boot Client For Apache Geode +## Spring Boot Client For Apache Geode Spring Boot for Apache Geode provides a powerful abstraction that simplifies the developer experience when using Spring Boot and Apache Geode. The best way to get started with Spring Boot @@ -204,22 +204,22 @@ dependencyManagement { This confirms that without adding any additional code, the application was able to connect to our Geode Cluster. -### Building an Application with Spring Boot for Apache Geode. +**Building an Application with Spring Boot for Apache Geode.** Spring Boot for Apache Geode is very powerful and robust. We recommend looking at the Spring Boot for Apache Geode documentation and examples for your next steps in working with this dependency. -### Additional Resources +**Additional Resources** - [Spring Boot for Apache Geode Reference Guide](https://docs.spring.io/spring-boot-data-geode-build/1.4.x/reference/html5/) -## <%=vars.product_name_long%> Native Clients +## <%=vars.product_name_long%> Native Clients To begin using the <%=vars.product_name_long%> Native Clients, you must first build the <%=vars.product_name_long%> Native Client libraries from the source code. You can download the <%=vars.product_name_long%> Native Source code here `https://geode.apache.org/releases`, then refer to the `BUILDING.md]` file in the source release to compile the libraries. -## <%=vars.product_name_long%> Native .NET Client +### <%=vars.product_name_long%> Native .NET Client **Put, Get and Remove with <%=vars.product_name_long%> Native .NET Client (C#)** @@ -280,14 +280,14 @@ namespace Apache.Geode.Examples.PutGetRemove } ``` -### Additional Resources +**Additional Resources** - [Apache Geode Native Client Examples GitHub Repo](https://github.com/apache/geode-native/tree/develop/examples) - [Apache Geode Native .NET Client Documentation](https://geode.apache.org/docs/) - [Apache Geode Native Client .NET API Reference](https://geode.apache.org/releases/latest/dotnetdocs/hierarchy.html) -## <%=vars.product_name_long%> Native C++ Client +### <%=vars.product_name_long%> Native C++ Client **Put, Get, and Remove with <%=vars.product_name_long%> Native C++ Client** @@ -341,13 +341,13 @@ int main(int argc, char** argv) { } ``` -### Additional Resources +**Additional Resources** - [Apache Geode Native Client Examples GitHub Repo](https://github.com/apache/geode-native/tree/develop/examples) - [Apache Geode Native C++ Client Documentation](https://geode.apache.org/docs/) - [Apache Geode Native Client C++ API Reference](https://geode.apache.org/releases/latest/cppdocs/hierarchy.html) -## Geode APIs Compatible with Redis +## Geode APIs Compatible with Redis The <%=vars.product_name_long%> APIs compatible with Redis allow <%=vars.product_name_long%> to function as a drop-in replacement for a highly-available Redis data store, letting Redis applications take advantage of From 0e6f09102ffdc32c372eb8d7c961d91ca9942c26 Mon Sep 17 00:00:00 2001 From: Dave Barnes Date: Mon, 14 Jun 2021 11:31:56 -0700 Subject: [PATCH 5/5] Incorporate reviewer suggestions & corrections --- .../intro_to_clients.html.md.erb | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/geode-docs/getting_started/intro_to_clients.html.md.erb b/geode-docs/getting_started/intro_to_clients.html.md.erb index 35e79141e94d..c553c9a823d9 100644 --- a/geode-docs/getting_started/intro_to_clients.html.md.erb +++ b/geode-docs/getting_started/intro_to_clients.html.md.erb @@ -54,9 +54,16 @@ gfsh> shutdown --include-locators=true ## <%=vars.product_name_long%> Java Client -**Maven Dependencies** +For a conventional Java client, provide the dependencies that are appropriate for your build +environment. (The Spring Boot framework, described later, provides a utility that generates these +dependencies for you.) + +Examples are shown here for Maven and Gradle. Replace $VERSION with the version of +<%=vars.product_name_long%> that you have installed. + -Declare the following dependency and replace $VERSION, with the version of <%=vars.product_name_long%> that you have installed. + +**Maven Dependencies** ``` @@ -72,11 +79,11 @@ Declare the following dependency and replace $VERSION, with the version of <%=va ``` dependencies { - compile "org.apache.geode:geode-core:$VERSION" + implementation "org.apache.geode:geode-core:$VERSION" } ``` -Connect to the server from your application +**Connect to the server from your application** ``` import org.apache.geode.cache.client.ClientCache; @@ -89,7 +96,7 @@ public class HelloWorld { System.out.println(cache.getDefaultPool().getLocators()); - cache.close(); + cache.close(); } } ``` @@ -186,14 +193,15 @@ dependencyManagement { } ``` -1. Connect to Geode from your application -2. Open your web browser to [Spring™ initializr](https://start.spring.io/). +**Connect to the server from your application** + +1. Open your web browser to [Spring™ initializr](https://start.spring.io/). -3. Click ‘Add Dependencies’. Search for the ‘Spring for Apache Geode’ dependency and add it to your project. Select ‘Generate’, which creates a zip file. Import this file into your IDE. +1. Click ‘Add Dependencies’. Search for the ‘Spring for Apache Geode’ dependency and add it to your project. Select ‘Generate’, which creates a zip file. Import this file into your IDE. -4. With your Geode cluster running, build and run the application (without making any other changes). +1. With your Geode cluster running, build and run the application (without making any other changes). -5. In the console output, you should see something similar to (starting with Spring Boot for Apache Geode v1.4.2+) +1. In the console output, you should see something similar to (starting with Spring Boot for Apache Geode v1.4.2+) ``` 2021-03-19 11:27:14.532 INFO 8730 --- [ main] o.s.g.c.a.ClusterAwareConfiguration : Successfully connected to localhost[40404] @@ -216,7 +224,7 @@ Spring Boot for Apache Geode is very powerful and robust. We recommend looking To begin using the <%=vars.product_name_long%> Native Clients, you must first build the <%=vars.product_name_long%> Native Client libraries from the source code. You can download the <%=vars.product_name_long%> Native Source code here -`https://geode.apache.org/releases`, then refer to the `BUILDING.md]` file in the source release to compile the libraries. +`https://geode.apache.org/releases`, then refer to the `BUILDING.md` file in the source release to compile the libraries. ### <%=vars.product_name_long%> Native .NET Client