GH-731 Add support for SDK CloudEvent type
The type itself comes form cloud event sdk. And while s-c-function provides native support for cloud events, this is necessary for cases when user uses CloudEvent type in the signature of a function Resolves #731
This commit is contained in:
@@ -25,8 +25,30 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.cloudevents</groupId>
|
||||
<artifactId>cloudevents-api</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package function.example;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import io.cloudevents.CloudEvent;
|
||||
|
||||
public class EchoCloudEventFunction implements Function<CloudEvent, CloudEvent> {
|
||||
|
||||
@Override
|
||||
public CloudEvent apply(CloudEvent value) {
|
||||
System.out.println("Received " + value);
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package function.example;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class UpperCaseFunction implements Function<String, String> {
|
||||
|
||||
@Override
|
||||
public String apply(String value) {
|
||||
System.out.println("Uppercasing " + value);
|
||||
return value.toUpperCase();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user