From d4d1d2bacf031e7ba3821b8f1215de2ec2c4efca Mon Sep 17 00:00:00 2001 From: Christian Tzolov Date: Tue, 30 Jan 2018 19:00:46 +0100 Subject: [PATCH] Align gemfire samples to scdf 1.3.0. Part of #50 --- src/main/asciidoc/maven-access.adoc | 2 +- .../asciidoc/streaming/gemfire/gemfire-cq-log/local.adoc | 3 +-- .../asciidoc/streaming/gemfire/gemfire-cq-log/pcf.adoc | 7 +++++-- src/main/asciidoc/streaming/gemfire/gemfire-log/pcf.adoc | 2 +- src/main/asciidoc/streaming/gemfire/http-gemfire/pcf.adoc | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/asciidoc/maven-access.adoc b/src/main/asciidoc/maven-access.adoc index 0e0a405..3307536 100644 --- a/src/main/asciidoc/maven-access.adoc +++ b/src/main/asciidoc/maven-access.adoc @@ -2,6 +2,6 @@ NOTE: These samples assume that the Data Flow Server can access a remote Maven r access to public repositories, you will need to install the sample apps in your internal Maven repository and https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#getting-started-maven-configuration[configure] the server accordingly. The sample applications are typically registered using Data Flow's bulk import facility. For example, the Shell command `dataflow:>app import --uri {app-import-rabbit-maven}` _(The actual URI is release and binder specific so refer to the sample instructions for the actual URL)_. The bulk import URI references a plain text file containing entries for all of the publicly available Spring Cloud Stream and Task applications published to `https://repo.spring.io`. For example, -`source.http=maven://org.springframework.cloud.stream.app:http-source-rabbit:1.2.0.RELEASE` registers the `http` source app at the corresponding Maven address, relative to the remote repository(ies) configured for the +`source.http=maven://org.springframework.cloud.stream.app:http-source-rabbit:1.3.1.RELEASE` registers the `http` source app at the corresponding Maven address, relative to the remote repository(ies) configured for the Data Flow server. The format is `maven://::` You will need to https://repo.spring.io/libs-release/org/springframework/cloud/stream/app/spring-cloud-stream-app-descriptor/Bacon.RELEASE/spring-cloud-stream-app-descriptor-Bacon.RELEASE.rabbit-apps-maven-repo-url.properties[download] the required apps or https://github.com/spring-cloud-stream-app-starters[build] them and then install them in your Maven repository, using whatever group, artifact, and version you choose. If you do this, register individual apps using `dataflow:>app register...` using the `maven://` resource URI format corresponding to your installed app. diff --git a/src/main/asciidoc/streaming/gemfire/gemfire-cq-log/local.adoc b/src/main/asciidoc/streaming/gemfire/gemfire-cq-log/local.adoc index 4ea2226..6bf2779 100644 --- a/src/main/asciidoc/streaming/gemfire/gemfire-cq-log/local.adoc +++ b/src/main/asciidoc/streaming/gemfire/gemfire-cq-log/local.adoc @@ -35,12 +35,11 @@ dataflow:>app import --uri {app-import-rabbit-maven} + This example creates an gemfire-cq source to which will publish events matching a query criteria on a region. In this case we will monitor the `Orders` region. For simplicity, we will avoid creating a data structure for the order. Each cache entry contains an integer value representing the quantity of the ordered item. This stream will fire a message whenever the value>999. By default, the source emits only the value. Here we will override that using the -`cq-event-expression` property. This accepts a SpEL expression bound to a https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/query/CqEvent.html[CQEvent]. To reference the entire CQEvent instace, we use `#this`. +`cq-event-expression` property. This accepts a SpEL expression bound to a https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/query/CqEvent.html[CQEvent]. To reference the entire CQEvent instance, we use `#this`. In order to display the contents in the log, we will invoke `toString()` on the instance. + ``` dataflow:>stream create --name orders --definition " gemfire-cq --query='SELECT * from /Orders o where o > 999' --cq-event-expression=#this.toString() | log" --deploy -Created and deployed new stream 'events' ``` NOTE: If the Geode locator isn't running on default port on `localhost`, add the options `--connect-type=locator --host-addresses=:`. If there are multiple locators, you can provide a comma separated list of locator addresses. This is not necessary for the sample but is typical for production environments to enable fail-over. diff --git a/src/main/asciidoc/streaming/gemfire/gemfire-cq-log/pcf.adoc b/src/main/asciidoc/streaming/gemfire/gemfire-cq-log/pcf.adoc index 8633b65..c11961c 100644 --- a/src/main/asciidoc/streaming/gemfire/gemfire-cq-log/pcf.adoc +++ b/src/main/asciidoc/streaming/gemfire/gemfire-cq-log/pcf.adoc @@ -109,8 +109,11 @@ You should see messages like: . Another interesting demonstration combines `gemfire-cq` with the link:../http-gemfire/README.adoc[http-gemfire] example. + ``` -dataflow:> stream create --name stocks --definition "http --port=9090 | gemfire-json-server --regionName=Stocks --keyExpression=payload.getField('symbol')" --deploy -dataflow:> stream create --name stock_watch --definition "gemfire-cq --query='Select * from /Stocks where symbol=''VMW''' | log" --deploy +dataflow:>stream create --name stocks --definition "http --security.basic.enabled=false | gemfire --json=true --username=developer --password= --connect-type=locator --host-addresses=10.0.16.25:55221 --regionName=Stocks --keyExpression=payload.getField('symbol')" --deploy + +dataflow:>stream create --name stock_watch --definition "gemfire-cq --username=developer --password= --connect-type=locator --host-addresses=10.0.16.25:55221 --query='SELECT * from /Stocks where symbol=''VMW''' --cq-event-expression=#this.toString() | log" --deploy + +dataflow:>http post --target http://data-flow-server-dpvuo77-stocks-http.apps.scdf-gcp.springapps.io/ --contentType application/json --data '{"symbol":"VMW","price":117.06}' ``` + . You're done! diff --git a/src/main/asciidoc/streaming/gemfire/gemfire-log/pcf.adoc b/src/main/asciidoc/streaming/gemfire/gemfire-log/pcf.adoc index 4513375..f05ce11 100644 --- a/src/main/asciidoc/streaming/gemfire/gemfire-log/pcf.adoc +++ b/src/main/asciidoc/streaming/gemfire/gemfire-log/pcf.adoc @@ -62,7 +62,7 @@ gfsh>create region --name Test --type=REPLICATE . Create the stream, connecting to the PCC instance as developer. This example creates an gemfire source to which will publish events on a region + ``` -dataflow stream create --name events --definition " gemfire --username=developer --password= --connect-type=locator --host-addresses=10.0.16.9:55221 --regionName=Test | log" --deploy +dataflow>stream create --name events --definition " gemfire --username=developer --password= --connect-type=locator --host-addresses=10.0.16.9:55221 --regionName=Test | log" --deploy ``` . Verify the stream is successfully deployed diff --git a/src/main/asciidoc/streaming/gemfire/http-gemfire/pcf.adoc b/src/main/asciidoc/streaming/gemfire/http-gemfire/pcf.adoc index 2204635..de6cfe1 100644 --- a/src/main/asciidoc/streaming/gemfire/http-gemfire/pcf.adoc +++ b/src/main/asciidoc/streaming/gemfire/http-gemfire/pcf.adoc @@ -70,7 +70,7 @@ Use of custom domain types requires these classes to be in the class path of bot For this reason, the use of custom payload types is generally discouraged. + ``` -dataflow:>stream create --name stocks --definition "http --security.basic.enabled=false | gemfire --username=developer --password= --connect-type=locator --host-addresses=10.0.16.9:55221 --regionName=Stocks --keyExpression=payload.getField('symbol')" --deploy +dataflow:>stream create --name stocks --definition "http --security.basic.enabled=false | gemfire --username=developer --password= --connect-type=locator --host-addresses=10.0.16.9:55221 --json=true --regionName=Stocks --keyExpression=payload.getField('symbol')" --deploy ``` . Verify the stream is successfully deployed