Knative
Send events to and receive events from Knative brokers, channels and services as CloudEvents over HTTP.
What’s inside
-
Knative component, URI syntax:
knative:type/typeId
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-knative-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 25 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.knative.api-version | The API version of the Kubernetes object of the resource, such as eventing.knative.dev/v1 for a broker. When set, the endpoint uses only the resources of the Knative environment with this objectApiVersion (or knative.apiVersion metadata). | String | |
camel.component.knative.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.knative.bridge-error-handler | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean |
camel.component.knative.ce-override | CloudEvents attributes to set on the events that the producer sends, and on the consumer reply with replyWithCloudEvent, with the ce.override. prefix. The name is the HTTP header of the attribute, such as ce-type or ce-source (a camelCase name such as ceSource becomes ce-source), and the value replaces the one of the message headers or of the defaults. A value can use property placeholders. | String> | |
camel.component.knative.cloud-events-spec-version | The version of the CloudEvents specification. The producer, and the consumer reply with replyWithCloudEvent, send it as the ce-specversion attribute when the CamelCloudEventVersion header is not set. All the versions use the attributes of CloudEvents 1.0. | 1.0 | String |
camel.component.knative.cloud-events-type | The CloudEvents type (ce-type) of the events that the producer sends, and of the consumer reply with replyWithCloudEvent, when neither the CamelCloudEventType header nor the event type of the resource in the Knative environment sets one. An endpoint of type event with a name in the URI sends that name as the type instead. | org.apache.camel.event | String |
camel.component.knative.configuration | The configuration of the component; each endpoint starts from a copy of it. The option is a org.apache.camel.component.knative.KnativeConfiguration type. | KnativeConfiguration | |
camel.component.knative.consumer-factory | The factory of the transport that creates the consumers. When not set, the component uses the KnativeConsumerFactory bean named after the protocol (http) in the registry, else the one of camel-knative-http on the classpath. The option is a org.apache.camel.component.knative.spi.KnativeConsumerFactory type. | KnativeConsumerFactory | |
camel.component.knative.enabled | Whether to enable auto configuration of the knative component. This is enabled by default. | Boolean | |
camel.component.knative.environment | The Knative environment: the resources (channels, endpoints and events) that the endpoints look up by type and name, each with the URL to send to or the path to receive on. When not set, the component loads it from environmentPath, else from the CAMEL_KNATIVE_CONFIGURATION environment variable (the JSON itself, or a file: or classpath: location), else uses the single KnativeEnvironment bean in the registry. KnativeResource beans in the registry are looked up as well. The option is a org.apache.camel.component.knative.spi.KnativeEnvironment type. | KnativeEnvironment | |
camel.component.knative.environment-path | The location of the Knative environment as a JSON file, such as classpath:knative.json or file:/etc/camel/knative.json (a classpath resource without a prefix). The JSON has a resources array; each resource has a type (channel, endpoint or event), a name, an endpointKind (source for a consumer, sink for a producer), the url to send to or the path to receive on, and optionally objectKind, objectApiVersion, objectName, cloudEventType, reply, filters, ceOverrides and metadata. Used when the environment option is not set, before the CAMEL_KNATIVE_CONFIGURATION environment variable. | String | |
camel.component.knative.filters | Filters of the consumer, with the filter. prefix: the consumer accepts only the HTTP requests where every named header equals the value or matches it as a Java regular expression. The name is a Camel CloudEvents header, such as CamelCloudEventSource (which checks the ce-source HTTP header), or an HTTP header name. A request that does not match goes to the next consumer on the same path. A structured-mode event (Content-Type application/cloudevents+json) has no ce-* HTTP headers, so a filter on a CloudEvents attribute does not accept it. | String> | |
camel.component.knative.health-check-consumer-enabled | Used for enabling or disabling all consumer based health checks from this component | true | Boolean |
camel.component.knative.health-check-producer-enabled | Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true. | true | Boolean |
camel.component.knative.kind | The kind of the Kubernetes object of the resource, such as Broker or InMemoryChannel. When set, the endpoint uses only the resources of the Knative environment with this objectKind (or knative.kind metadata). | String | |
camel.component.knative.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
camel.component.knative.mute-exception | Whether to leave the stack trace out of the response when the exchange failed: the consumer answers the error status (500 unless the CamelHttpResponseCode header sets one) with an empty body. When false, the body is the stack trace as text/plain. Applies only with reply. | true | Boolean |
camel.component.knative.name | The name of the Kubernetes object of the resource, such as the name of the broker. When set, the endpoint uses only the resources of the Knative environment with this objectName (or knative.name metadata). The producer of an endpoint of type event also looks up the resource by this name, as the name in its URI is the CloudEvents type. | String | |
camel.component.knative.producer-factory | The factory of the transport that creates the producers. When not set, the component uses the KnativeProducerFactory bean named after the protocol (http) in the registry, else the one of camel-knative-http on the classpath. The option is a org.apache.camel.component.knative.spi.KnativeProducerFactory type. | KnativeProducerFactory | |
camel.component.knative.reply | Whether the consumer sends the message headers and body back in the HTTP response. When false, it answers 204 No Content without a body (or the error status when the exchange failed). When not set, the reply setting of the resource in the Knative environment applies, which is true by default. | true | Boolean |
camel.component.knative.reply-with-cloud-event | Whether the consumer replies with a CloudEvent: as the producer does, the reply gets the ce-* HTTP headers from the CamelCloudEvent headers (those of the received event unless the route changes them), the cloudEventsType and the ceOverride options. A Knative broker publishes such a reply as a new event, so give it another type (for example with ceOverride) or the consumer may receive its own reply again; an endpoint of type event replies with the type in its URI, the type it consumes. When false, the reply does not get the CloudEvents attributes. Needs reply. | false | Boolean |
camel.component.knative.sink-binding | The Knative SinkBinding that the producer sends to. Knative injects the URL of the sink into the bound workload as the K_SINK environment variable (read as the property k.sink) and the CloudEvents overrides as K_CE_OVERRIDES (property k.ce.overrides); the component adds a sink resource with that URL and with the name, type, object kind and API version of the binding to the Knative environment. The producer health check is DOWN while K_SINK is not set. Only the component configuration adds the resource: set on an endpoint, only the health check uses it. The option is a org.apache.camel.component.knative.spi.KnativeSinkBinding type. | KnativeSinkBinding | |
camel.component.knative.synchronous | Whether the consumer routes each request synchronously. When true, the route runs on a thread of the Vert.x worker pool, which waits until the route is complete, so the size of the worker pool limits how many requests are routed at the same time. When false, the route starts on a worker thread with the asynchronous routing engine, and the worker thread is free as soon as the route continues on another thread (such as an asynchronous producer), so the worker pool no longer limits the requests in flight. Keep it false for a route that calls an asynchronous producer using the same Vert.x as the HTTP server (such as vertx-http in Camel Quarkus): with true, such requests can occupy every worker thread while their producers need a worker thread to complete, and then no request completes. (currently only supported by camel-knative-http) | false | Boolean |
camel.component.knative.transport-options | Options of the transport (camel-knative-http), with the transport. prefix, set on the HTTP consumer and producer that the transport creates, for example transport.maxBodySize or transport.basePath of the consumer. Set on the component, they also configure the transport factories that the component discovers. Unknown options are ignored. | Object> | |
camel.component.knative.type-id | The name of the resource to look up in the Knative environment, for every endpoint of the component, in place of the name in the endpoint URI. For an endpoint of type event, it is also the CloudEvents type that the consumer accepts. | String |