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

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

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • None
    • False
    • None
    • False
    • ---
    • ---

      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)

      CloudEvent ID should be generated or customizable as in https://issues.redhat.com/browse/KOGITO-8848.

      {
        "id": "myworkflow",
        "specVersion": "0.8",
        "version": "1.0",
        "start": "State1",
        "functions": [
          {
            "name": "function1",
            "type": "custom",
            "operation": "kubernetes:serving.knative.dev/v1/mynamespace/myservice",
            "metadata": {
              "cloudEvent": 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
              Marian Macik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: