Skip to content

Commit

Permalink
examples: improve knative example
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed May 21, 2020
1 parent 158c202 commit 77f4227
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"type": { "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.Knative.Type", "enum": [ "endpoint", "channel", "event" ], "deprecated": false, "secret": false, "description": "The Knative type" },
"name": { "kind": "path", "displayName": "Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The Knative name" },
"ceOverride": { "kind": "parameter", "displayName": "Ce Override", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "ce.override.", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "CloudEvent headers to override" },
"cloudEventsSpecVersion": { "kind": "parameter", "displayName": "Cloud Events Spec Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "0.1", "0.2", "0.3", "1.0" ], "deprecated": false, "secret": false, "defaultValue": "0.1", "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the version of the cloudevents spec." },
"cloudEventsSpecVersion": { "kind": "parameter", "displayName": "Cloud Events Spec Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "0.1", "0.2", "0.3", "1.0" ], "deprecated": false, "secret": false, "defaultValue": "1.0", "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the version of the cloudevents spec." },
"cloudEventsType": { "kind": "parameter", "displayName": "Cloud Events Type", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "org.apache.camel.event", "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the event-type information of the produced events." },
"environment": { "kind": "parameter", "displayName": "Environment", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.KnativeEnvironment", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The environment" },
"filters": { "kind": "parameter", "displayName": "Filters", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "filter.", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the filters." },
Expand Down
2 changes: 1 addition & 1 deletion examples/camel-k-runtime-example-knative/data/env.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"services": [{
"type": "endpoint",
"name": "from",
"name": "echoer",
"metadata": {
"camel.endpoint.kind": "source"
}
Expand Down
38 changes: 26 additions & 12 deletions examples/camel-k-runtime-example-knative/data/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,29 @@
# limitations under the License.
#

- route:
id: "knative"
group: "routes"
from:
uri: "knative:endpoint/from"
steps:
- convert-body-to:
type: "java.lang.String"
- to:
uri: "log:knative"
- set-body:
constant: "Hello from camel-k (native)"
- from:
uri: "knative:endpoint/echoer"
steps:
- log:
message: "Got Message: ${body}"
- convert-body-to: "java.lang.String"
- choice:
when:
- simple: "${body} != null && ${body.length} > 0"
steps:
- set-body:
simple: "${body.toUpperCase()}"
- set-header:
name: ContentType
simple: text/plain
- log:
message: "${body}"
otherwise:
steps:
- set-body:
constant: "no body received"
- set-header:
name: ContentType
simple: text/plain
- log:
message: "Otherwise::${body}"

0 comments on commit 77f4227

Please sign in to comment.