You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ni...@apache.org on 2022/08/05 03:27:52 UTC

[openwhisk-runtime-java] 11/12: Add document

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

ningyougang pushed a commit to branch support-array-result-include-sequence-action
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-java.git

commit 574da1647189b07ed409c19cdd6f65c6a3b3e62c
Author: ning.yougang <ni...@navercorp.com>
AuthorDate: Fri Aug 5 10:25:40 2022 +0800

    Add document
---
 README.md | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/README.md b/README.md
index 58f46c9..c7ce6ca 100644
--- a/README.md
+++ b/README.md
@@ -68,6 +68,36 @@ If needed you can also customize the method name of your Java action. This
 can be done by specifying the Java fully-qualified method name of your action,
 e.q., `--main com.example.MyMain#methodName`
 
+Not only support return JsonObject but also support return JsonArray, the main function would be:
+
+```java
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+
+public class HelloArray {
+    public static JsonArray main(JsonObject args) {
+        JsonArray jsonArray = new JsonArray();
+        jsonArray.add("a");
+        jsonArray.add("b");
+        return jsonArray;
+    }
+}
+```
+
+And support array result for sequence action as well, the first action's array result can be used as next action's input parameter.
+
+So the function would be:
+
+```java
+import com.google.gson.JsonArray;
+
+public class Sort {
+    public static JsonArray main(JsonArray args) {
+        return args;
+    }
+}
+```
+
 ### Create the Java Action
 To use as a docker action:
 ```