Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-8409

[SW] Add support to Cloud Events to Knative custom function

XMLWordPrintable

    • 2023 Week 09-11 (from Feb 27), 2023 Week 12-14 (from Mar 20)

      Users should be allowed to choose if they want to send the request data in a plain JSON object (default) or in a CloudEvent object.

      The CloudEvents specification defines two ways of sending messages: "structured-mode" and "binary-mode".

      https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md#message

      When using CloudEvents, Kogito must validate if the function argument is a valid CE, use the "structured-mode" and set "Content-Type" as "application/cloudevents+json; charset=UTF-8".

      When not using CloudEvents, Kogito must validate if the function argument is not a CE. Otherwise throw an error. (CE are not allowed when 'asCloudEvent' = false)

      {
        "id": "myworkflow",
        "specVersion": "0.8",
        "version": "1.0",
        "start": "State1",
        "functions": [
          {
            "name": "function1",
            "type": "custom",
            "operation": "knative:mynamespace/func1",
            "metadata": {
              "asCloudEvent": true,
              "path": "/my_path"
            }
        ],
        "states": [
          {
            "name": "State1",
            "type": "operation",
            "actions": [
              {
                "functionRef": {
                  "refName": "function1",
                  "arguments": {
                      "specversion" : "1.0",
                      "type" : "com.github.pull_request.opened",
                      "source" : "https://github.com/cloudevents/spec/pull",
                      "subject" : "123",
                      "id" : "A234-1234-1234",
                      "time" : "2018-04-05T17:31:00Z",
                      "comexampleextension1" : "value",
                      "comexampleothervalue" : 5,
                      "datacontenttype" : "text/xml",
                      "data" : "<much wow=\"xml\"/>"
                  }
                }
              }
            ],
            "end": true
          }
        ]
      }
      

            hbelmiro@redhat.com Helber Belmiro
            hbelmiro@redhat.com Helber Belmiro
            Tristan Radisson Tristan Radisson
            Marian Macik Marian Macik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: