You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by db...@apache.org on 2018/08/09 17:21:59 UTC

[geode-native] branch develop updated: GEODE-4336: C++ Remote Query Example, add README.md (#328)

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

dbarnes pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new db6a3f7  GEODE-4336: C++ Remote Query Example, add README.md (#328)
db6a3f7 is described below

commit db6a3f7468cf260ee93d79aa25c29537c534ca55
Author: Dave Barnes <db...@pivotal.io>
AuthorDate: Thu Aug 9 10:21:57 2018 -0700

    GEODE-4336: C++ Remote Query Example, add README.md (#328)
---
 examples/cpp/CMakeLists.txt        |  2 +-
 examples/cpp/remotequery/README.md | 59 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 0efd36c..8d7d17d 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -59,4 +59,4 @@ add_example(NAME put-get-remove
 	SOURCE main.cpp)
 
 add_example(NAME remotequery
-	SOURCE main.cpp Order.cpp Order.hpp)
+	SOURCE main.cpp Order.cpp Order.hpp README.md)
diff --git a/examples/cpp/remotequery/README.md b/examples/cpp/remotequery/README.md
new file mode 100644
index 0000000..581b1ee
--- /dev/null
+++ b/examples/cpp/remotequery/README.md
@@ -0,0 +1,59 @@
+# Remote Query Example
+This is a simple example showing how to create and execute a remote query.
+
+## Prerequisites
+* An installation of Apache Geode.
+* Apache Geode Native, built and installed.
+* Apache Geode Native examples, built and installed.
+* A `GEODE_HOME` environment variable set to the location of the Apache Geode installation.
+* `GEODE_HOME/bin` in the execution path.
+
+## Running
+1. Set the current directory to the `remotequery` directory in the installed directory tree.
+
+  ```
+  $ cd <install-dir>/examples/cpp/remotequery
+  ```
+
+1. Run the `startserver.sh` script to start the Geode server, create a region, and populate the region with sample data.
+
+  ```
+  $ sh ./startserver.sh
+  /Users/user/geode16/bin/gfsh
+
+  (1) Executing - start locator --name=locator
+  ...
+  (2) Executing - start server --name=server
+  ...
+  (3) Executing - create region --name=custom_orders --type=PARTITION
+
+  Member | Status
+  ------ | -------------------------------------------
+  server | Region "/custom_orders" created on "server"
+  ```
+
+1. Execute `remotequery`:
+
+  ```
+  $ build/remotequery
+  Create orders
+  Storing orders in the region
+  Getting the orders from the region
+  The following orders have a quantity greater than 30:
+  OrderID: 2 Product Name: product y Quantity: 37
+  OrderID: 4 Product Name: product z Quantity: 102
+  OrderID: 6 Product Name: product z Quantity: 42
+  ```
+
+1. Stop the server
+
+  ```
+  $ sh ./stopserver.sh
+  /Users/user/geode16/bin/gfsh
+  (1) Executing - connect
+  ...
+  (2) Executing - stop server --name=server
+  ...
+  (3) Executing - stop locator --name=locator
+  ....
+  ```