GH-422 Formalize Cloud Event conversion strategy to consistently handle binary-mode and structured-mode cloud events

Moved CloudEvent related artifacts to ‘cloud events’ package with hopes to eventually donating it to CNCF SDK
Created CloudEventUtils identifying necessary constants and utility methods
This commit is contained in:
Oleg Zhurakousky
2020-11-12 15:13:35 +01:00
parent daa3c27226
commit a26ad928f6
14 changed files with 703 additions and 95 deletions

View File

@@ -38,7 +38,24 @@ provides a good example on how to accomplish this.
### Function as a REST endpoint
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/<function_name>`)
functions by using function name as path (e.g., `localhost:8080/<function_name>`).
Just add this to your dependency
[source, xml]
----
<!-- REST - only needed if you intend to invoke via HTTP -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-web</artifactId>
<version>3.1.0-SNAPSHOT</version>
</dependency>
<!-- end REST -->
----
Here is an example of curl command posting a cloud event in binary-mode: