This is an automated email from the ASF dual-hosted git repository. apupier pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 20cac6c42e17c4fcca73f6299df08d822411d6eb Author: Urmila Unni <[email protected]> AuthorDate: Wed Sep 30 10:21:49 2026 +0530 CAMEL-24803: camel-knative - Declare the CloudEvent headers in the component metadata Add the CloudEvent header constants with @Metadata to KnativeConstants and reference it via headersClass on KnativeEndpoint. Co-authored-by: Claude <[email protected]> --- .../apache/camel/catalog/components/knative.json | 10 ++++++++ .../apache/camel/component/knative/knative.json | 10 ++++++++ .../camel/component/knative/KnativeConstants.java | 30 ++++++++++++++++++++++ .../camel/component/knative/KnativeEndpoint.java | 3 ++- 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/knative.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/knative.json index e9d93d28649f..74889bd75c64 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/knative.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/knative.json @@ -49,6 +49,16 @@ "healthCheckConsumerEnabled": { "index": 21, "kind": "property", "displayName": "Health Check Consumer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all consumer based health checks from this component" }, "healthCheckProducerEnabled": { "index": 22, "kind": "property", "displayName": "Health Check Producer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "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 produce [...] }, + "headers": { + "CamelCloudEventID": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event ID. The producer uses the exchange ID when not set.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_ID" }, + "CamelCloudEventSource": { "index": 1, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event source. The producer uses the route ID when not set.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_SOURCE" }, + "CamelCloudEventVersion": { "index": 2, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The CloudEvents specification version. The producer uses the configured version when not set.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_VERSION" }, + "CamelCloudEventType": { "index": 3, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event type. On a knative event endpoint with a type ID in the URI, the type ID takes precedence over this header.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_TYPE" }, + "CamelCloudEventDataContentType": { "index": 4, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content type of the event data.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_DATA_CONTENT_TYPE" }, + "CamelCloudEventSchemaURL": { "index": 5, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The URI of the schema that the event data adheres to.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_SCHEMA_URL" }, + "CamelCloudEventSubject": { "index": 6, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The subject of the event in the context of the event source.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_SUBJECT" }, + "CamelCloudEventTime": { "index": 7, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The time the event occurred. The producer uses the exchange creation time when not set.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_TIME" } + }, "properties": { "type": { "index": 0, "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.knative.spi.Knative.Type", "enum": [ "endpoint", "channel", "event" ], "deprecated": false, "autowired": false, "secret": false, "description": "The Knative resource type" }, "typeId": { "index": 1, "kind": "path", "displayName": "Type Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The identifier of the Knative resource" }, diff --git a/components/camel-knative/camel-knative-component/src/generated/resources/META-INF/org/apache/camel/component/knative/knative.json b/components/camel-knative/camel-knative-component/src/generated/resources/META-INF/org/apache/camel/component/knative/knative.json index e9d93d28649f..74889bd75c64 100644 --- a/components/camel-knative/camel-knative-component/src/generated/resources/META-INF/org/apache/camel/component/knative/knative.json +++ b/components/camel-knative/camel-knative-component/src/generated/resources/META-INF/org/apache/camel/component/knative/knative.json @@ -49,6 +49,16 @@ "healthCheckConsumerEnabled": { "index": 21, "kind": "property", "displayName": "Health Check Consumer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all consumer based health checks from this component" }, "healthCheckProducerEnabled": { "index": 22, "kind": "property", "displayName": "Health Check Producer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "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 produce [...] }, + "headers": { + "CamelCloudEventID": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event ID. The producer uses the exchange ID when not set.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_ID" }, + "CamelCloudEventSource": { "index": 1, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event source. The producer uses the route ID when not set.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_SOURCE" }, + "CamelCloudEventVersion": { "index": 2, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The CloudEvents specification version. The producer uses the configured version when not set.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_VERSION" }, + "CamelCloudEventType": { "index": 3, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event type. On a knative event endpoint with a type ID in the URI, the type ID takes precedence over this header.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_TYPE" }, + "CamelCloudEventDataContentType": { "index": 4, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content type of the event data.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_DATA_CONTENT_TYPE" }, + "CamelCloudEventSchemaURL": { "index": 5, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The URI of the schema that the event data adheres to.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_SCHEMA_URL" }, + "CamelCloudEventSubject": { "index": 6, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The subject of the event in the context of the event source.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_SUBJECT" }, + "CamelCloudEventTime": { "index": 7, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The time the event occurred. The producer uses the exchange creation time when not set.", "constantName": "org.apache.camel.component.knative.KnativeConstants#CLOUD_EVENT_TIME" } + }, "properties": { "type": { "index": 0, "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.knative.spi.Knative.Type", "enum": [ "endpoint", "channel", "event" ], "deprecated": false, "autowired": false, "secret": false, "description": "The Knative resource type" }, "typeId": { "index": 1, "kind": "path", "displayName": "Type Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The identifier of the Knative resource" }, diff --git a/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeConstants.java b/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeConstants.java index 2d5e5ceb78e1..c108cdd2f6a0 100644 --- a/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeConstants.java +++ b/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeConstants.java @@ -16,10 +16,40 @@ */ package org.apache.camel.component.knative; +import org.apache.camel.cloudevents.CloudEvent; +import org.apache.camel.spi.Metadata; + public final class KnativeConstants { public static final String SCHEME = "knative"; public static final String CONFIGURATION_ENV_VARIABLE = "CAMEL_KNATIVE_CONFIGURATION"; + @Metadata(label = "common", + description = "The event ID. The producer uses the exchange ID when not set.", javaType = "String") + public static final String CLOUD_EVENT_ID = CloudEvent.CAMEL_CLOUD_EVENT_ID; + @Metadata(label = "common", + description = "The event source. The producer uses the route ID when not set.", javaType = "String") + public static final String CLOUD_EVENT_SOURCE = CloudEvent.CAMEL_CLOUD_EVENT_SOURCE; + @Metadata(label = "common", + description = "The CloudEvents specification version. The producer uses the configured version when not set.", + javaType = "String") + public static final String CLOUD_EVENT_VERSION = CloudEvent.CAMEL_CLOUD_EVENT_VERSION; + @Metadata(label = "common", + description = "The event type. On a knative event endpoint with a type ID in the URI, the type ID takes precedence over this header.", + javaType = "String") + public static final String CLOUD_EVENT_TYPE = CloudEvent.CAMEL_CLOUD_EVENT_TYPE; + @Metadata(label = "common", description = "The content type of the event data.", javaType = "String") + public static final String CLOUD_EVENT_DATA_CONTENT_TYPE = CloudEvent.CAMEL_CLOUD_EVENT_DATA_CONTENT_TYPE; + @Metadata(label = "common", description = "The URI of the schema that the event data adheres to.", + javaType = "String") + public static final String CLOUD_EVENT_SCHEMA_URL = CloudEvent.CAMEL_CLOUD_EVENT_SCHEMA_URL; + @Metadata(label = "common", description = "The subject of the event in the context of the event source.", + javaType = "String") + public static final String CLOUD_EVENT_SUBJECT = CloudEvent.CAMEL_CLOUD_EVENT_SUBJECT; + @Metadata(label = "common", + description = "The time the event occurred. The producer uses the exchange creation time when not set.", + javaType = "String") + public static final String CLOUD_EVENT_TIME = CloudEvent.CAMEL_CLOUD_EVENT_TIME; + private KnativeConstants() { } } diff --git a/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java b/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java index c8a51df1e6f3..5c2530dd8e4a 100644 --- a/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java +++ b/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java @@ -54,7 +54,8 @@ import org.slf4j.LoggerFactory; scheme = "knative", syntax = "knative:type/typeId", title = "Knative", - category = Category.CLOUD) + category = Category.CLOUD, + headersClass = KnativeConstants.class) @Metadata(annotations = { "protocol=http", })
