From 4cef2b1bc1c1acd5e8630d2d3970c788bcaa7b74 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Tue, 17 Nov 2020 08:49:58 +0100 Subject: [PATCH] GH-422, GH-606 Update documentation page with initial Cloud Events documentation Resolves #422 Resolves #606 --- docs/src/main/asciidoc/index.adoc | 2 +- .../function-sample-cloudevent/README.adoc | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/src/main/asciidoc/index.adoc b/docs/src/main/asciidoc/index.adoc index 199bcba1e..9e3deeac4 100644 --- a/docs/src/main/asciidoc/index.adoc +++ b/docs/src/main/asciidoc/index.adoc @@ -9,6 +9,7 @@ The reference documentation consists of the following sections: [horizontal] <> :: Spring Cloud Function Reference +https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples/function-sample-cloudevent[Cloud Events] :: Cloud Events <> :: AWS Adapter Reference <> :: Azure Adapter Reference <> :: GCP Adapter Reference @@ -18,4 +19,3 @@ Relevant Links: [horizontal] https://projectreactor.io/[Reactor] :: Project Reactor -https://projectriff.io/[riff] :: Project riff diff --git a/spring-cloud-function-samples/function-sample-cloudevent/README.adoc b/spring-cloud-function-samples/function-sample-cloudevent/README.adoc index 68ad52aa2..303dbf87f 100644 --- a/spring-cloud-function-samples/function-sample-cloudevent/README.adoc +++ b/spring-cloud-function-samples/function-sample-cloudevent/README.adoc @@ -5,14 +5,18 @@ The current example uses spring-cloud-function framework as its core which allow their requirement while taking care-off non-functional aspects. For more information on Spring Cloud Function please visit our https://spring.io/projects/spring-cloud-function[project page]. -The example provides dependencies and instructions to demonstrate several distinct invocation models: +The example consists of a class https://github.com/spring-cloud/spring-cloud-function/blob/master/spring-cloud-function-samples/function-sample-cloudevent/src/main/java/io/spring/cloudevent/CloudeventDemoApplication.java[CloudeventDemoApplication] +which contains a set of function beans of different type signatures which you can interact with following instructions below. + +It also provides necessary dependencies and instructions to demonstrate several distinct invocation models: - _Direct function invocation_ - _Function as a REST endpoint_ - _Function as message handler (e.g., Kafka, RabbitMQ etc)_ - _Function invocation via RSocket_ -The POM file defines all the necessary dependency in a segregated way, so you can choose the one you're interested in. +The POM file defines all the necessary dependency in a segregated way, so you can choose the one you're interested in by commenting in/out dependencies +that fit your scenario (e.g., Streaming vs. REST, ect_ ### Direct function invocation @@ -40,7 +44,7 @@ provides a good example on how to accomplish this. Given that SCF allows function to be exposed as REST endpoints, you can post cloud event to any of the functions by using function name as path (e.g., `localhost:8080/`). -Just add this to your dependency +Just add this to your dependency (or in your case simply un-comment) [source, xml] ---- @@ -90,6 +94,8 @@ curl -w'\n' localhost:8080/asString \ }' ---- +Feel free to change the function you're invoking by changing URI path (e.g., `localhost:8080/asString` to `localhost:8080/consumeAndProduceCloudEventAsPojoToPojo`). + ### Function as message handler (e.g., Kafka, RabbitMQ etc) Streaming support for Apache Kafka and RabbitMQ is provided via https://spring.io/projects/spring-cloud-stream[Spring Cloud Stream] framework.