This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new f9d8068ffef0 CAMEL-27046: camel-alibaba-eventbridge - require endpoint
instead of region, and document the operation header (#30254)
f9d8068ffef0 is described below
commit f9d8068ffef0d373ff46ffd6e101ff8a8083baa0
Author: Saravanakumar Selvaraj <[email protected]>
AuthorDate: Tue Nov 17 09:00:50 2026 +0000
CAMEL-27046: camel-alibaba-eventbridge - require endpoint instead of
region, and document the operation header (#30254)
…region, and document the operation header
region was marked as required and endpoint was not, although the SDK client
needs the endpoint and sends the region only
as a header. createClient threw "Region or endpoint is required" only when
both were empty, so a URI with only a region
failed at the first message in the SDK. The operation header was declared
only in AlibabaEventBridgeProperties, which
the build does not read, so it was missing from the header list of the
component.
endpoint is now required, as in camel-alibaba-ots, and region is not, and
createClient checks the endpoint alone, with
"Endpoint is required". OPERATION moves into AlibabaEventBridgeHeaders with
the text of the operation header of
camel-alibaba-ots, and AlibabaEventBridgeProperties still inherits it. The
examples of the doc page set the endpoint,
and the component JSON, the catalog and the Endpoint DSL are regenerated. A
new test of CamelCatalogTest and the new
CreateClientTest cover the change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../catalog/components/alibaba-eventbridge.json | 25 ++++++-----
.../docs/alibaba-eventbridge-component.adoc | 27 +++++++-----
.../org/apache/camel/catalog/CamelCatalogTest.java | 15 +++++++
.../alibaba/eventbridge/alibaba-eventbridge.json | 25 ++++++-----
.../main/docs/alibaba-eventbridge-component.adoc | 27 +++++++-----
.../eventbridge/AlibabaEventBridgeEndpoint.java | 2 +-
.../eventbridge/AlibabaEventBridgeUtils.java | 8 ++--
.../constants/AlibabaEventBridgeHeaders.java | 6 +++
.../constants/AlibabaEventBridgeProperties.java | 5 ---
.../alibaba/eventbridge/CreateClientTest.java | 51 ++++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 12 +++++
.../AlibabaEventBridgeEndpointBuilderFactory.java | 16 ++++++-
12 files changed, 161 insertions(+), 58 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-eventbridge.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-eventbridge.json
index c80254803913..a596ce7894a9 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-eventbridge.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-eventbridge.json
@@ -30,16 +30,17 @@
"healthCheckProducerEnabled": { "index": 3, "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 producer [...]
},
"headers": {
- "CamelAlibabaEventBridgeEventBusName": { "index": 0, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the event bus for a JSON text or Map body. This
header replaces the eventBusName option. If this header is not set, an exchange
property of the same name replaces the eventBusName option. The key
eventBusName of a Map body replac [...]
- "CamelAlibabaEventBridgeEventSource": { "index": 1, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event source for a JSON text or Map body. The value must be
a URI. This header replaces the eventSource option. If this header is not set,
an exchange property of the same name replaces the eventSource option. The key
eventSource or sourc [...]
- "CamelAlibabaEventBridgeEventType": { "index": 2, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event type for a JSON text or Map body. This header
replaces the eventType option. If this header is not set, an exchange property
of the same name replaces the eventType option. The key eventType or type of a
Map body replaces this header. [...]
- "CamelAlibabaEventBridgeEventSubject": { "index": 3, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event subject for a JSON text or Map body. This header
replaces the eventSubject option. If this header is not set, an exchange
property of the same name replaces the eventSubject option. The key
eventSubject or subject of a Map body rep [...]
- "CamelAlibabaEventBridgeValidateEventSource": { "index": 4, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check that the event bus
exists and has a rule that matches the event source. The producer calls
listEventBuses and listRules to check this. The producer also checks that each
event source that allowedEventSources lists fo [...]
- "CamelAlibabaEventBridgeValidateEventType": { "index": 5, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check that the event bus
exists and has a rule that matches the event source and event type. The
producer calls listEventBuses and listRules to check this. The producer also
checks that each event type that allowedEventSourc [...]
- "CamelAlibabaEventBridgeValidateEventSpec": { "index": 6, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check the keys specversion
and id of a Map body. The value of specversion must be 1.0, and the value of id
must not be blank. This header replaces the validateEventSpec option. If this
header is not set, an exchange property [...]
- "CamelAlibabaEventBridgeAllowedEventSources": { "index": 7, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Object", "deprecated": false, "autowired":
false, "secret": false, "description": "The event sources and event types that
the producer allows on each event bus. The value must be a Map, a Collection or
a String as in the allowedEventSources option. This header replaces the
allowedEventSources option. If this header [...]
- "CamelAlibabaEventBridgeEventSourceCacheTtl": { "index": 8, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Long", "deprecated": false, "autowired": false,
"secret": false, "description": "The time in milliseconds for which the
producer caches the result of listEventBuses and listRules for an event bus.
Only used when validateEventSource or validateEventType is true. Use 0 or less
to cache nothing. This header replaces th [...]
- "CamelAlibabaEventBridgeRequestId": { "index": 9, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The request ID that EventBridge returns in the response to the
operation. The producer sets it, unless the exchange fails.", "constantName":
"org.apache.camel.component.alibaba.eventbridge.constants.AlibabaEventBridgeHeaders#REQUEST_ID"
}
+ "CamelAlibabaEventBridgeOperation": { "index": 0, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The operation that the producer performs. This header replaces
the operation option. If this header is not set, an exchange property of the
same name replaces the operation option.", "constantName":
"org.apache.camel.component.alibaba.eventbrid [...]
+ "CamelAlibabaEventBridgeEventBusName": { "index": 1, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the event bus for a JSON text or Map body. This
header replaces the eventBusName option. If this header is not set, an exchange
property of the same name replaces the eventBusName option. The key
eventBusName of a Map body replac [...]
+ "CamelAlibabaEventBridgeEventSource": { "index": 2, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event source for a JSON text or Map body. The value must be
a URI. This header replaces the eventSource option. If this header is not set,
an exchange property of the same name replaces the eventSource option. The key
eventSource or sourc [...]
+ "CamelAlibabaEventBridgeEventType": { "index": 3, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event type for a JSON text or Map body. This header
replaces the eventType option. If this header is not set, an exchange property
of the same name replaces the eventType option. The key eventType or type of a
Map body replaces this header. [...]
+ "CamelAlibabaEventBridgeEventSubject": { "index": 4, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event subject for a JSON text or Map body. This header
replaces the eventSubject option. If this header is not set, an exchange
property of the same name replaces the eventSubject option. The key
eventSubject or subject of a Map body rep [...]
+ "CamelAlibabaEventBridgeValidateEventSource": { "index": 5, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check that the event bus
exists and has a rule that matches the event source. The producer calls
listEventBuses and listRules to check this. The producer also checks that each
event source that allowedEventSources lists fo [...]
+ "CamelAlibabaEventBridgeValidateEventType": { "index": 6, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check that the event bus
exists and has a rule that matches the event source and event type. The
producer calls listEventBuses and listRules to check this. The producer also
checks that each event type that allowedEventSourc [...]
+ "CamelAlibabaEventBridgeValidateEventSpec": { "index": 7, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check the keys specversion
and id of a Map body. The value of specversion must be 1.0, and the value of id
must not be blank. This header replaces the validateEventSpec option. If this
header is not set, an exchange property [...]
+ "CamelAlibabaEventBridgeAllowedEventSources": { "index": 8, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Object", "deprecated": false, "autowired":
false, "secret": false, "description": "The event sources and event types that
the producer allows on each event bus. The value must be a Map, a Collection or
a String as in the allowedEventSources option. This header replaces the
allowedEventSources option. If this header [...]
+ "CamelAlibabaEventBridgeEventSourceCacheTtl": { "index": 9, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Long", "deprecated": false, "autowired": false,
"secret": false, "description": "The time in milliseconds for which the
producer caches the result of listEventBuses and listRules for an event bus.
Only used when validateEventSource or validateEventType is true. Use 0 or less
to cache nothing. This header replaces th [...]
+ "CamelAlibabaEventBridgeRequestId": { "index": 10, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The request ID that EventBridge returns in the response to the
operation. The producer sets it, unless the exchange fails.", "constantName":
"org.apache.camel.component.alibaba.eventbridge.constants.AlibabaEventBridgeHeaders#REQUEST_ID"
}
},
"bodyTypes": {
"producerIn": { "carriers": [ "text", "bytes", "stream", "file", "map",
"list", "pojo" ], "description": "The event to publish: the JSON text of the
data of the event, as text, or as bytes, a stream or a file read in the charset
of the exchange (UTF-8 by default), with the source, the type and the bus from
the options or headers; a Map of the event fields, such as eventSource,
eventType and eventData, where a Map or a POJO as data is serialized to JSON; a
CloudEvent of the Alibaba SD [...]
@@ -48,12 +49,12 @@
"properties": {
"operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "producer", "label": "producer", "required": true, "type": "enum",
"javaType": "java.lang.String", "enum": [ "putEvents" ], "deprecated": false,
"autowired": false, "secret": false, "description": "The operation that the
producer performs. The CamelAlibabaEventBridgeOperation header replaces this
option for a request that the producer sends. If that header is not set, an
exchange property of the same name [...]
"allowedEventSources": { "index": 1, "kind": "parameter", "displayName":
"Allowed Event Sources", "group": "producer", "label": "producer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "The event sources and
event types that the producer allows on each event bus. Written as JSON or as
bus blocks in the form bus1[source1 = type1,type2] | bus2[source2 = type3].
Semicolons separate the event [...]
- "endpoint": { "index": 2, "kind": "parameter", "displayName": "Endpoint",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The endpoint of EventBridge, which is a host
name without http:\/\/ or https:\/\/. The region option does not determine the
endpoint, so this option is required. Not used when the eventBridgeClient
option is set or autowired." },
+ "endpoint": { "index": 2, "kind": "parameter", "displayName": "Endpoint",
"group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The endpoint of EventBridge, which is a host
name without http:\/\/ or https:\/\/. The region option does not determine the
endpoint, so this option is required. Not used when the eventBridgeClient
option is set or autowired." },
"eventBusName": { "index": 3, "kind": "parameter", "displayName": "Event
Bus Name", "group": "producer", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "The name of the event bus for a JSON
text or Map body. The CamelAlibabaEventBridgeEventBusName header replaces this
option for a request that the producer sends. If that header is not set, an
exchange property of the same name [...]
"eventSource": { "index": 4, "kind": "parameter", "displayName": "Event
Source", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The event source for a JSON text or Map body.
The value must be a URI. The CamelAlibabaEventBridgeEventSource header replaces
this option for a request that the producer sends. If that header is not set,
an exchange property of th [...]
"eventSubject": { "index": 5, "kind": "parameter", "displayName": "Event
Subject", "group": "producer", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "The event subject for a JSON text or
Map body. The CamelAlibabaEventBridgeEventSubject header replaces this option
for a request that the producer sends. If that header is not set, an exchange
property of the same name replaces [...]
"eventType": { "index": 6, "kind": "parameter", "displayName": "Event
Type", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The event type for a JSON text or Map body.
The CamelAlibabaEventBridgeEventType header replaces this option for a request
that the producer sends. If that header is not set, an exchange property of the
same name replaces this option. [...]
- "region": { "index": 7, "kind": "parameter", "displayName": "Region",
"group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The region ID of EventBridge, for example
cn-hangzhou. The producer sends it in the HTTP header x-eventbridge-regionId of
each request. Not used when the eventBridgeClient option is set or autowired."
},
+ "region": { "index": 7, "kind": "parameter", "displayName": "Region",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The region ID of EventBridge, for example
cn-hangzhou. The producer sends it in the HTTP header x-eventbridge-regionId of
each request. Not used when the eventBridgeClient option is set or autowired."
},
"validateEventSource": { "index": 8, "kind": "parameter", "displayName":
"Validate Event Source", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to check that the event bus exists and has a rule that matches the
event source. The producer calls listEventBuses and listRules to check this.
The producer also checks that each eve [...]
"validateEventSpec": { "index": 9, "kind": "parameter", "displayName":
"Validate Event Spec", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether to check the keys specversion and id of a Map body. The value of
specversion must be 1.0, and the value of id must not be blank. The
CamelAlibabaEventBridgeValidateEventSpec header replac [...]
"validateEventType": { "index": 10, "kind": "parameter", "displayName":
"Validate Event Type", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to check that the event bus exists and has a rule that matches the
event source and event type. The producer calls listEventBuses and listRules to
check this. The producer also checks t [...]
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-eventbridge-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-eventbridge-component.adoc
index af536e9d0921..317217529d8a 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-eventbridge-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-eventbridge-component.adoc
@@ -49,7 +49,7 @@ include::partial$component-endpoint-headers.adoc[]
The component defines constants in package
`org.apache.camel.component.alibaba.eventbridge.constants`:
* `AlibabaEventBridgeHeaders` defines all message header constants evaluated
or set by the EventBridge producer.
-* `AlibabaEventBridgeProperties` extends `AlibabaEventBridgeHeaders` and
provides constants for Exchange properties (such as `OPERATION`), while
inheriting all header constants.
+* `AlibabaEventBridgeProperties` extends `AlibabaEventBridgeHeaders` and
inherits all its constants, for use as Exchange property names (such as
`OPERATION`).
==== Message headers evaluated by the EventBridge producer
@@ -57,6 +57,8 @@ The component defines constants in package
`org.apache.camel.component.alibaba.e
|=======================================================================
|Constant (`AlibabaEventBridgeHeaders`) |Header String |Type |Description
+|`OPERATION` |`CamelAlibabaEventBridgeOperation` |`String` | Name of operation
to invoke, such as `putEvents` (overrides the endpoint option).
+
|`EVENT_BUS_NAME` |`CamelAlibabaEventBridgeEventBusName` |`String` | Event bus
name to publish events to (overrides the endpoint option).
|`EVENT_SOURCE` |`CamelAlibabaEventBridgeEventSource` |`String` | Event source
URI (overrides the endpoint option).
@@ -77,7 +79,7 @@ The component defines constants in package
`org.apache.camel.component.alibaba.e
|=======================================================================
-If any of the above headers are set, they will override their corresponding
exchange property or query parameter value.
+If any of the above headers are set, they will override their corresponding
exchange property or endpoint option.
==== Message headers set by the EventBridge producer
@@ -169,7 +171,7 @@ Java::
----
from("platform-http:/ingress")
.removeHeaders("CamelAlibabaEventBridge*")
-
.to("alibaba-eventbridge:putEvents?eventBusName=orders-bus&eventSource=app.orders&eventType=order:created:v1&allowedEventSources=RAW(app.orders
-> order:created:v1)®ion=cn-hangzhou")
+
.to("alibaba-eventbridge:putEvents?eventBusName=orders-bus&eventSource=app.orders&eventType=order:created:v1&allowedEventSources=RAW(app.orders
->
order:created:v1)®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com")
.marshal().json();
----
@@ -191,6 +193,7 @@ YAML::
eventType: order:created:v1
allowedEventSources: "RAW(app.orders -> order:created:v1)"
region: cn-hangzhou
+ endpoint: 12345.eventbridge.cn-hangzhou.aliyuncs.com
- marshal:
json: {}
----
@@ -253,7 +256,7 @@ acs:oss:cn-hangzhou:12345:my-bucket ->
oss:ObjectCreated:PutObject, oss:ObjectCr
In the endpoint URI (using `RAW(...)` to preserve special characters):
[source,text]
----
-alibaba-eventbridge:putEvents?eventBusName=my-bus&allowedEventSources=RAW(acs:oss:cn-hangzhou:12345:my-bucket
-> oss:ObjectCreated:PutObject, oss:ObjectCreated:PostObject; app.orders ->
order:created:v1)®ion=cn-hangzhou&accessKey=RAW(ak)&secretKey=RAW(sk)
+alibaba-eventbridge:putEvents?eventBusName=my-bus&allowedEventSources=RAW(acs:oss:cn-hangzhou:12345:my-bucket
-> oss:ObjectCreated:PutObject, oss:ObjectCreated:PostObject; app.orders ->
order:created:v1)®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(ak)&secretKey=RAW(sk)
----
==== Multi-Bus Configuration
@@ -278,7 +281,7 @@ orders-bus[acs:oss:cn-hangzhou:12345:orders ->
oss:ObjectCreated:PutObject; app.
*In the endpoint URI:*
[source,text]
----
-alibaba-eventbridge:putEvents?allowedEventSources=RAW(orders-bus[acs:oss:cn-hangzhou:12345:orders
-> oss:ObjectCreated:PutObject] | payments-bus[app.payments ->
payment:captured:v1])®ion=cn-hangzhou&accessKey=RAW(ak)&secretKey=RAW(sk)
+alibaba-eventbridge:putEvents?allowedEventSources=RAW(orders-bus[acs:oss:cn-hangzhou:12345:orders
-> oss:ObjectCreated:PutObject] | payments-bus[app.payments ->
payment:captured:v1])®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(ak)&secretKey=RAW(sk)
----
If a message targeted for `orders-bus` attempts to use an event source
configured only under `payments-bus`, validation fails with an
`IllegalArgumentException`.
@@ -372,7 +375,7 @@ Java::
----
from("direct:start")
.setBody(constant("{\"orderId\":\"123\"}"))
-
.to("alibaba-eventbridge:putEvents?eventBusName=my-bus&eventSource=camel.test&eventType=OrderCreated®ion=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+
.to("alibaba-eventbridge:putEvents?eventBusName=my-bus&eventSource=camel.test&eventType=OrderCreated®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
YAML::
@@ -394,6 +397,7 @@ YAML::
eventSource: camel.test
eventType: OrderCreated
region: cn-hangzhou
+ endpoint: 12345.eventbridge.cn-hangzhou.aliyuncs.com
accessKey: "{{alibaba.access-key}}"
secretKey: "{{alibaba.secret-key}}"
----
@@ -412,7 +416,7 @@ event.put("eventData", Map.of("orderId", "123"));
from("direct:start")
.setBody(constant(event))
-
.to("alibaba-eventbridge:putEvents?region=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+
.to("alibaba-eventbridge:putEvents?region=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
=== Single-Bus Allowed Event Sources Validation
@@ -430,7 +434,7 @@ from("direct:start")
+ "?eventBusName=orders-bus"
+ "&allowedEventSources=RAW(acs:oss:cn-hangzhou:12345:my-bucket ->
oss:ObjectCreated:PutObject, oss:ObjectCreated:PostObject; app.orders ->
order:created:v1)"
+ "&validateEventSource=true&validateEventType=true"
- +
"®ion=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+ +
"®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
=== Multi-Bus Allowed Event Sources Validation (Batch Publishing)
@@ -445,7 +449,7 @@ from("direct:start")
.to("alibaba-eventbridge:putEvents"
+
"?allowedEventSources=RAW(orders-bus[acs:oss:cn-hangzhou:12345:orders ->
oss:ObjectCreated:PutObject] | payments-bus[app.payments ->
payment:captured:v1])"
+ "&validateEventSource=true&validateEventType=true"
- +
"®ion=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+ +
"®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
=== JSON Configuration for Allowed Event Sources
@@ -472,7 +476,7 @@ from("direct:start")
"type", "order:created:v1",
"data", Map.of("orderId", "ORD-12345")
)))
-
.to("alibaba-eventbridge:putEvents?region=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+
.to("alibaba-eventbridge:putEvents?region=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
=== Dynamic Header and Property Overrides
@@ -489,7 +493,7 @@ from("direct:start")
.setHeader(AlibabaEventBridgeHeaders.VALIDATE_EVENT_TYPE, constant(true))
.setHeader(AlibabaEventBridgeHeaders.ALLOWED_EVENT_SOURCES,
constant("acs:oss:cn-hangzhou:12345:bucket -> oss:ObjectCreated:PutObject;
app.orders -> order:created:v1"))
.setBody(constant("{\"orderId\":\"123\"}"))
-
.to("alibaba-eventbridge:putEvents?eventSource=app.orders&eventType=order:created:v1®ion=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+
.to("alibaba-eventbridge:putEvents?eventSource=app.orders&eventType=order:created:v1®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
YAML::
@@ -530,6 +534,7 @@ YAML::
eventSource: app.orders
eventType: order:created:v1
region: cn-hangzhou
+ endpoint: 12345.eventbridge.cn-hangzhou.aliyuncs.com
accessKey: "{{alibaba.access-key}}"
secretKey: "{{alibaba.secret-key}}"
----
diff --git
a/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
b/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
index 03144d2c6643..15f261cb1e24 100644
---
a/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
+++
b/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
@@ -1676,6 +1676,21 @@ public class CamelCatalogTest {
assertEquals("5p", result.getInvalidDuration().get("period"));
}
+ @Test
+ public void testValidateEndpointAlibabaEventBridge() {
+ String uri =
"alibaba-eventbridge:putEvents?endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com";
+ EndpointValidationResult result =
catalog.validateEndpointProperties(uri);
+ assertTrue(result.isSuccess(), result.summaryErrorMessage(false));
+
+ uri = "alibaba-eventbridge:putEvents?region=cn-hangzhou";
+ result = catalog.validateEndpointProperties(uri);
+ assertFalse(result.isSuccess());
+ assertEquals("endpoint", result.getRequired().iterator().next());
+
+ ComponentModel model = catalog.componentModel("alibaba-eventbridge");
+ assertTrue(model.getEndpointHeaders().stream().anyMatch(h ->
"CamelAlibabaEventBridgeOperation".equals(h.getName())));
+ }
+
@Test
public void testValidateEndpointHttpPropertyPlaceholder() {
String uri =
"http://api.openweathermap.org/data/2.5/weather?{{property.weatherUri}}";
diff --git
a/components/camel-alibaba/camel-alibaba-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/alibaba/eventbridge/alibaba-eventbridge.json
b/components/camel-alibaba/camel-alibaba-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/alibaba/eventbridge/alibaba-eventbridge.json
index c80254803913..a596ce7894a9 100644
---
a/components/camel-alibaba/camel-alibaba-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/alibaba/eventbridge/alibaba-eventbridge.json
+++
b/components/camel-alibaba/camel-alibaba-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/alibaba/eventbridge/alibaba-eventbridge.json
@@ -30,16 +30,17 @@
"healthCheckProducerEnabled": { "index": 3, "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 producer [...]
},
"headers": {
- "CamelAlibabaEventBridgeEventBusName": { "index": 0, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the event bus for a JSON text or Map body. This
header replaces the eventBusName option. If this header is not set, an exchange
property of the same name replaces the eventBusName option. The key
eventBusName of a Map body replac [...]
- "CamelAlibabaEventBridgeEventSource": { "index": 1, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event source for a JSON text or Map body. The value must be
a URI. This header replaces the eventSource option. If this header is not set,
an exchange property of the same name replaces the eventSource option. The key
eventSource or sourc [...]
- "CamelAlibabaEventBridgeEventType": { "index": 2, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event type for a JSON text or Map body. This header
replaces the eventType option. If this header is not set, an exchange property
of the same name replaces the eventType option. The key eventType or type of a
Map body replaces this header. [...]
- "CamelAlibabaEventBridgeEventSubject": { "index": 3, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event subject for a JSON text or Map body. This header
replaces the eventSubject option. If this header is not set, an exchange
property of the same name replaces the eventSubject option. The key
eventSubject or subject of a Map body rep [...]
- "CamelAlibabaEventBridgeValidateEventSource": { "index": 4, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check that the event bus
exists and has a rule that matches the event source. The producer calls
listEventBuses and listRules to check this. The producer also checks that each
event source that allowedEventSources lists fo [...]
- "CamelAlibabaEventBridgeValidateEventType": { "index": 5, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check that the event bus
exists and has a rule that matches the event source and event type. The
producer calls listEventBuses and listRules to check this. The producer also
checks that each event type that allowedEventSourc [...]
- "CamelAlibabaEventBridgeValidateEventSpec": { "index": 6, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check the keys specversion
and id of a Map body. The value of specversion must be 1.0, and the value of id
must not be blank. This header replaces the validateEventSpec option. If this
header is not set, an exchange property [...]
- "CamelAlibabaEventBridgeAllowedEventSources": { "index": 7, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Object", "deprecated": false, "autowired":
false, "secret": false, "description": "The event sources and event types that
the producer allows on each event bus. The value must be a Map, a Collection or
a String as in the allowedEventSources option. This header replaces the
allowedEventSources option. If this header [...]
- "CamelAlibabaEventBridgeEventSourceCacheTtl": { "index": 8, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Long", "deprecated": false, "autowired": false,
"secret": false, "description": "The time in milliseconds for which the
producer caches the result of listEventBuses and listRules for an event bus.
Only used when validateEventSource or validateEventType is true. Use 0 or less
to cache nothing. This header replaces th [...]
- "CamelAlibabaEventBridgeRequestId": { "index": 9, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The request ID that EventBridge returns in the response to the
operation. The producer sets it, unless the exchange fails.", "constantName":
"org.apache.camel.component.alibaba.eventbridge.constants.AlibabaEventBridgeHeaders#REQUEST_ID"
}
+ "CamelAlibabaEventBridgeOperation": { "index": 0, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The operation that the producer performs. This header replaces
the operation option. If this header is not set, an exchange property of the
same name replaces the operation option.", "constantName":
"org.apache.camel.component.alibaba.eventbrid [...]
+ "CamelAlibabaEventBridgeEventBusName": { "index": 1, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the event bus for a JSON text or Map body. This
header replaces the eventBusName option. If this header is not set, an exchange
property of the same name replaces the eventBusName option. The key
eventBusName of a Map body replac [...]
+ "CamelAlibabaEventBridgeEventSource": { "index": 2, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event source for a JSON text or Map body. The value must be
a URI. This header replaces the eventSource option. If this header is not set,
an exchange property of the same name replaces the eventSource option. The key
eventSource or sourc [...]
+ "CamelAlibabaEventBridgeEventType": { "index": 3, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event type for a JSON text or Map body. This header
replaces the eventType option. If this header is not set, an exchange property
of the same name replaces the eventType option. The key eventType or type of a
Map body replaces this header. [...]
+ "CamelAlibabaEventBridgeEventSubject": { "index": 4, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The event subject for a JSON text or Map body. This header
replaces the eventSubject option. If this header is not set, an exchange
property of the same name replaces the eventSubject option. The key
eventSubject or subject of a Map body rep [...]
+ "CamelAlibabaEventBridgeValidateEventSource": { "index": 5, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check that the event bus
exists and has a rule that matches the event source. The producer calls
listEventBuses and listRules to check this. The producer also checks that each
event source that allowedEventSources lists fo [...]
+ "CamelAlibabaEventBridgeValidateEventType": { "index": 6, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check that the event bus
exists and has a rule that matches the event source and event type. The
producer calls listEventBuses and listRules to check this. The producer also
checks that each event type that allowedEventSourc [...]
+ "CamelAlibabaEventBridgeValidateEventSpec": { "index": 7, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Boolean", "deprecated": false, "autowired":
false, "secret": false, "description": "Whether to check the keys specversion
and id of a Map body. The value of specversion must be 1.0, and the value of id
must not be blank. This header replaces the validateEventSpec option. If this
header is not set, an exchange property [...]
+ "CamelAlibabaEventBridgeAllowedEventSources": { "index": 8, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Object", "deprecated": false, "autowired":
false, "secret": false, "description": "The event sources and event types that
the producer allows on each event bus. The value must be a Map, a Collection or
a String as in the allowedEventSources option. This header replaces the
allowedEventSources option. If this header [...]
+ "CamelAlibabaEventBridgeEventSourceCacheTtl": { "index": 9, "kind":
"header", "displayName": "", "group": "producer", "label": "producer",
"required": false, "javaType": "Long", "deprecated": false, "autowired": false,
"secret": false, "description": "The time in milliseconds for which the
producer caches the result of listEventBuses and listRules for an event bus.
Only used when validateEventSource or validateEventType is true. Use 0 or less
to cache nothing. This header replaces th [...]
+ "CamelAlibabaEventBridgeRequestId": { "index": 10, "kind": "header",
"displayName": "", "group": "producer", "label": "producer", "required": false,
"javaType": "String", "deprecated": false, "autowired": false, "secret": false,
"description": "The request ID that EventBridge returns in the response to the
operation. The producer sets it, unless the exchange fails.", "constantName":
"org.apache.camel.component.alibaba.eventbridge.constants.AlibabaEventBridgeHeaders#REQUEST_ID"
}
},
"bodyTypes": {
"producerIn": { "carriers": [ "text", "bytes", "stream", "file", "map",
"list", "pojo" ], "description": "The event to publish: the JSON text of the
data of the event, as text, or as bytes, a stream or a file read in the charset
of the exchange (UTF-8 by default), with the source, the type and the bus from
the options or headers; a Map of the event fields, such as eventSource,
eventType and eventData, where a Map or a POJO as data is serialized to JSON; a
CloudEvent of the Alibaba SD [...]
@@ -48,12 +49,12 @@
"properties": {
"operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "producer", "label": "producer", "required": true, "type": "enum",
"javaType": "java.lang.String", "enum": [ "putEvents" ], "deprecated": false,
"autowired": false, "secret": false, "description": "The operation that the
producer performs. The CamelAlibabaEventBridgeOperation header replaces this
option for a request that the producer sends. If that header is not set, an
exchange property of the same name [...]
"allowedEventSources": { "index": 1, "kind": "parameter", "displayName":
"Allowed Event Sources", "group": "producer", "label": "producer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "The event sources and
event types that the producer allows on each event bus. Written as JSON or as
bus blocks in the form bus1[source1 = type1,type2] | bus2[source2 = type3].
Semicolons separate the event [...]
- "endpoint": { "index": 2, "kind": "parameter", "displayName": "Endpoint",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The endpoint of EventBridge, which is a host
name without http:\/\/ or https:\/\/. The region option does not determine the
endpoint, so this option is required. Not used when the eventBridgeClient
option is set or autowired." },
+ "endpoint": { "index": 2, "kind": "parameter", "displayName": "Endpoint",
"group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The endpoint of EventBridge, which is a host
name without http:\/\/ or https:\/\/. The region option does not determine the
endpoint, so this option is required. Not used when the eventBridgeClient
option is set or autowired." },
"eventBusName": { "index": 3, "kind": "parameter", "displayName": "Event
Bus Name", "group": "producer", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "The name of the event bus for a JSON
text or Map body. The CamelAlibabaEventBridgeEventBusName header replaces this
option for a request that the producer sends. If that header is not set, an
exchange property of the same name [...]
"eventSource": { "index": 4, "kind": "parameter", "displayName": "Event
Source", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The event source for a JSON text or Map body.
The value must be a URI. The CamelAlibabaEventBridgeEventSource header replaces
this option for a request that the producer sends. If that header is not set,
an exchange property of th [...]
"eventSubject": { "index": 5, "kind": "parameter", "displayName": "Event
Subject", "group": "producer", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "The event subject for a JSON text or
Map body. The CamelAlibabaEventBridgeEventSubject header replaces this option
for a request that the producer sends. If that header is not set, an exchange
property of the same name replaces [...]
"eventType": { "index": 6, "kind": "parameter", "displayName": "Event
Type", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The event type for a JSON text or Map body.
The CamelAlibabaEventBridgeEventType header replaces this option for a request
that the producer sends. If that header is not set, an exchange property of the
same name replaces this option. [...]
- "region": { "index": 7, "kind": "parameter", "displayName": "Region",
"group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The region ID of EventBridge, for example
cn-hangzhou. The producer sends it in the HTTP header x-eventbridge-regionId of
each request. Not used when the eventBridgeClient option is set or autowired."
},
+ "region": { "index": 7, "kind": "parameter", "displayName": "Region",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The region ID of EventBridge, for example
cn-hangzhou. The producer sends it in the HTTP header x-eventbridge-regionId of
each request. Not used when the eventBridgeClient option is set or autowired."
},
"validateEventSource": { "index": 8, "kind": "parameter", "displayName":
"Validate Event Source", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to check that the event bus exists and has a rule that matches the
event source. The producer calls listEventBuses and listRules to check this.
The producer also checks that each eve [...]
"validateEventSpec": { "index": 9, "kind": "parameter", "displayName":
"Validate Event Spec", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether to check the keys specversion and id of a Map body. The value of
specversion must be 1.0, and the value of id must not be blank. The
CamelAlibabaEventBridgeValidateEventSpec header replac [...]
"validateEventType": { "index": 10, "kind": "parameter", "displayName":
"Validate Event Type", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether to check that the event bus exists and has a rule that matches the
event source and event type. The producer calls listEventBuses and listRules to
check this. The producer also checks t [...]
diff --git
a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/docs/alibaba-eventbridge-component.adoc
b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/docs/alibaba-eventbridge-component.adoc
index af536e9d0921..317217529d8a 100644
---
a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/docs/alibaba-eventbridge-component.adoc
+++
b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/docs/alibaba-eventbridge-component.adoc
@@ -49,7 +49,7 @@ include::partial$component-endpoint-headers.adoc[]
The component defines constants in package
`org.apache.camel.component.alibaba.eventbridge.constants`:
* `AlibabaEventBridgeHeaders` defines all message header constants evaluated
or set by the EventBridge producer.
-* `AlibabaEventBridgeProperties` extends `AlibabaEventBridgeHeaders` and
provides constants for Exchange properties (such as `OPERATION`), while
inheriting all header constants.
+* `AlibabaEventBridgeProperties` extends `AlibabaEventBridgeHeaders` and
inherits all its constants, for use as Exchange property names (such as
`OPERATION`).
==== Message headers evaluated by the EventBridge producer
@@ -57,6 +57,8 @@ The component defines constants in package
`org.apache.camel.component.alibaba.e
|=======================================================================
|Constant (`AlibabaEventBridgeHeaders`) |Header String |Type |Description
+|`OPERATION` |`CamelAlibabaEventBridgeOperation` |`String` | Name of operation
to invoke, such as `putEvents` (overrides the endpoint option).
+
|`EVENT_BUS_NAME` |`CamelAlibabaEventBridgeEventBusName` |`String` | Event bus
name to publish events to (overrides the endpoint option).
|`EVENT_SOURCE` |`CamelAlibabaEventBridgeEventSource` |`String` | Event source
URI (overrides the endpoint option).
@@ -77,7 +79,7 @@ The component defines constants in package
`org.apache.camel.component.alibaba.e
|=======================================================================
-If any of the above headers are set, they will override their corresponding
exchange property or query parameter value.
+If any of the above headers are set, they will override their corresponding
exchange property or endpoint option.
==== Message headers set by the EventBridge producer
@@ -169,7 +171,7 @@ Java::
----
from("platform-http:/ingress")
.removeHeaders("CamelAlibabaEventBridge*")
-
.to("alibaba-eventbridge:putEvents?eventBusName=orders-bus&eventSource=app.orders&eventType=order:created:v1&allowedEventSources=RAW(app.orders
-> order:created:v1)®ion=cn-hangzhou")
+
.to("alibaba-eventbridge:putEvents?eventBusName=orders-bus&eventSource=app.orders&eventType=order:created:v1&allowedEventSources=RAW(app.orders
->
order:created:v1)®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com")
.marshal().json();
----
@@ -191,6 +193,7 @@ YAML::
eventType: order:created:v1
allowedEventSources: "RAW(app.orders -> order:created:v1)"
region: cn-hangzhou
+ endpoint: 12345.eventbridge.cn-hangzhou.aliyuncs.com
- marshal:
json: {}
----
@@ -253,7 +256,7 @@ acs:oss:cn-hangzhou:12345:my-bucket ->
oss:ObjectCreated:PutObject, oss:ObjectCr
In the endpoint URI (using `RAW(...)` to preserve special characters):
[source,text]
----
-alibaba-eventbridge:putEvents?eventBusName=my-bus&allowedEventSources=RAW(acs:oss:cn-hangzhou:12345:my-bucket
-> oss:ObjectCreated:PutObject, oss:ObjectCreated:PostObject; app.orders ->
order:created:v1)®ion=cn-hangzhou&accessKey=RAW(ak)&secretKey=RAW(sk)
+alibaba-eventbridge:putEvents?eventBusName=my-bus&allowedEventSources=RAW(acs:oss:cn-hangzhou:12345:my-bucket
-> oss:ObjectCreated:PutObject, oss:ObjectCreated:PostObject; app.orders ->
order:created:v1)®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(ak)&secretKey=RAW(sk)
----
==== Multi-Bus Configuration
@@ -278,7 +281,7 @@ orders-bus[acs:oss:cn-hangzhou:12345:orders ->
oss:ObjectCreated:PutObject; app.
*In the endpoint URI:*
[source,text]
----
-alibaba-eventbridge:putEvents?allowedEventSources=RAW(orders-bus[acs:oss:cn-hangzhou:12345:orders
-> oss:ObjectCreated:PutObject] | payments-bus[app.payments ->
payment:captured:v1])®ion=cn-hangzhou&accessKey=RAW(ak)&secretKey=RAW(sk)
+alibaba-eventbridge:putEvents?allowedEventSources=RAW(orders-bus[acs:oss:cn-hangzhou:12345:orders
-> oss:ObjectCreated:PutObject] | payments-bus[app.payments ->
payment:captured:v1])®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(ak)&secretKey=RAW(sk)
----
If a message targeted for `orders-bus` attempts to use an event source
configured only under `payments-bus`, validation fails with an
`IllegalArgumentException`.
@@ -372,7 +375,7 @@ Java::
----
from("direct:start")
.setBody(constant("{\"orderId\":\"123\"}"))
-
.to("alibaba-eventbridge:putEvents?eventBusName=my-bus&eventSource=camel.test&eventType=OrderCreated®ion=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+
.to("alibaba-eventbridge:putEvents?eventBusName=my-bus&eventSource=camel.test&eventType=OrderCreated®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
YAML::
@@ -394,6 +397,7 @@ YAML::
eventSource: camel.test
eventType: OrderCreated
region: cn-hangzhou
+ endpoint: 12345.eventbridge.cn-hangzhou.aliyuncs.com
accessKey: "{{alibaba.access-key}}"
secretKey: "{{alibaba.secret-key}}"
----
@@ -412,7 +416,7 @@ event.put("eventData", Map.of("orderId", "123"));
from("direct:start")
.setBody(constant(event))
-
.to("alibaba-eventbridge:putEvents?region=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+
.to("alibaba-eventbridge:putEvents?region=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
=== Single-Bus Allowed Event Sources Validation
@@ -430,7 +434,7 @@ from("direct:start")
+ "?eventBusName=orders-bus"
+ "&allowedEventSources=RAW(acs:oss:cn-hangzhou:12345:my-bucket ->
oss:ObjectCreated:PutObject, oss:ObjectCreated:PostObject; app.orders ->
order:created:v1)"
+ "&validateEventSource=true&validateEventType=true"
- +
"®ion=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+ +
"®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
=== Multi-Bus Allowed Event Sources Validation (Batch Publishing)
@@ -445,7 +449,7 @@ from("direct:start")
.to("alibaba-eventbridge:putEvents"
+
"?allowedEventSources=RAW(orders-bus[acs:oss:cn-hangzhou:12345:orders ->
oss:ObjectCreated:PutObject] | payments-bus[app.payments ->
payment:captured:v1])"
+ "&validateEventSource=true&validateEventType=true"
- +
"®ion=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+ +
"®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
=== JSON Configuration for Allowed Event Sources
@@ -472,7 +476,7 @@ from("direct:start")
"type", "order:created:v1",
"data", Map.of("orderId", "ORD-12345")
)))
-
.to("alibaba-eventbridge:putEvents?region=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+
.to("alibaba-eventbridge:putEvents?region=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
=== Dynamic Header and Property Overrides
@@ -489,7 +493,7 @@ from("direct:start")
.setHeader(AlibabaEventBridgeHeaders.VALIDATE_EVENT_TYPE, constant(true))
.setHeader(AlibabaEventBridgeHeaders.ALLOWED_EVENT_SOURCES,
constant("acs:oss:cn-hangzhou:12345:bucket -> oss:ObjectCreated:PutObject;
app.orders -> order:created:v1"))
.setBody(constant("{\"orderId\":\"123\"}"))
-
.to("alibaba-eventbridge:putEvents?eventSource=app.orders&eventType=order:created:v1®ion=cn-hangzhou&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
+
.to("alibaba-eventbridge:putEvents?eventSource=app.orders&eventType=order:created:v1®ion=cn-hangzhou&endpoint=12345.eventbridge.cn-hangzhou.aliyuncs.com&accessKey=RAW(accessKey)&secretKey=RAW(secretKey)");
----
YAML::
@@ -530,6 +534,7 @@ YAML::
eventSource: app.orders
eventType: order:created:v1
region: cn-hangzhou
+ endpoint: 12345.eventbridge.cn-hangzhou.aliyuncs.com
accessKey: "{{alibaba.access-key}}"
secretKey: "{{alibaba.secret-key}}"
----
diff --git
a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeEndpoint.java
b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeEndpoint.java
index 01e7381cd196..9c64ac0d11a0 100644
---
a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeEndpoint.java
+++
b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeEndpoint.java
@@ -65,13 +65,13 @@ public class AlibabaEventBridgeEndpoint extends
DefaultEndpoint {
+ " x-eventbridge-regionId of each request. Not
used when the eventBridgeClient option is set or"
+ " autowired.",
displayName = "Region")
- @Metadata(required = true)
private String region;
@UriParam(description = "The endpoint of EventBridge, which is a host name
without http:// or https://. The region option"
+ " does not determine the endpoint, so this
option is required. Not used when the"
+ " eventBridgeClient option is set or autowired.",
displayName = "Endpoint")
+ @Metadata(required = true)
private String endpoint;
@UriParam(description = "The AccessKey ID of the AccessKey pair for the
requests that the producer sends to EventBridge. If"
diff --git
a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeUtils.java
b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeUtils.java
index 7978421866b6..a008ee27829f 100644
---
a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeUtils.java
+++
b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeUtils.java
@@ -59,8 +59,8 @@ public final class AlibabaEventBridgeUtils {
}
public static EventBridgeClient createClient(AlibabaEventBridgeEndpoint
endpoint) {
- if (ObjectHelper.isEmpty(endpoint.getRegion()) &&
ObjectHelper.isEmpty(endpoint.getEndpoint())) {
- throw new IllegalArgumentException("Region or endpoint is
required");
+ if (ObjectHelper.isEmpty(endpoint.getEndpoint())) {
+ throw new IllegalArgumentException("Endpoint is required");
}
Config config = new Config();
@@ -69,9 +69,7 @@ public final class AlibabaEventBridgeUtils {
if (ObjectHelper.isNotEmpty(endpoint.getRegion())) {
config.setRegionId(endpoint.getRegion());
}
- if (ObjectHelper.isNotEmpty(endpoint.getEndpoint())) {
- config.setEndpoint(endpoint.getEndpoint());
- }
+ config.setEndpoint(endpoint.getEndpoint());
return new EventBridgeClient(config);
}
diff --git
a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/constants/AlibabaEventBridgeHeaders.java
b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/constants/AlibabaEventBridgeHeaders.java
index 570841aa1a96..a133feddb731 100644
---
a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/constants/AlibabaEventBridgeHeaders.java
+++
b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/constants/AlibabaEventBridgeHeaders.java
@@ -20,6 +20,12 @@ import org.apache.camel.spi.Metadata;
public sealed class AlibabaEventBridgeHeaders permits
AlibabaEventBridgeProperties {
+ @Metadata(label = "producer",
+ description = "The operation that the producer performs. This
header replaces the operation option. If this"
+ + " header is not set, an exchange property of the
same name replaces the operation option.",
+ javaType = "String")
+ public static final String OPERATION = "CamelAlibabaEventBridgeOperation";
+
@Metadata(label = "producer",
description = "The name of the event bus for a JSON text or Map
body. This header replaces the eventBusName"
+ " option. If this header is not set, an exchange
property of the same name replaces the"
diff --git
a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/constants/AlibabaEventBridgeProperties.java
b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/constants/AlibabaEventBridgeProperties.java
index 23b79683d5de..15783d3cd7fb 100644
---
a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/constants/AlibabaEventBridgeProperties.java
+++
b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/constants/AlibabaEventBridgeProperties.java
@@ -16,13 +16,8 @@
*/
package org.apache.camel.component.alibaba.eventbridge.constants;
-import org.apache.camel.spi.Metadata;
-
public final class AlibabaEventBridgeProperties extends
AlibabaEventBridgeHeaders {
- @Metadata(label = "producer", description = "Operation to perform",
javaType = "String")
- public static final String OPERATION = "CamelAlibabaEventBridgeOperation";
-
private AlibabaEventBridgeProperties() {
}
}
diff --git
a/components/camel-alibaba/camel-alibaba-eventbridge/src/test/java/org/apache/camel/component/alibaba/eventbridge/CreateClientTest.java
b/components/camel-alibaba/camel-alibaba-eventbridge/src/test/java/org/apache/camel/component/alibaba/eventbridge/CreateClientTest.java
new file mode 100644
index 000000000000..c5495cc8e36a
--- /dev/null
+++
b/components/camel-alibaba/camel-alibaba-eventbridge/src/test/java/org/apache/camel/component/alibaba/eventbridge/CreateClientTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.alibaba.eventbridge;
+
+import com.aliyun.eventbridge.EventBridgeClient;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class CreateClientTest {
+
+ @Test
+ void aRegionWithoutAnEndpointIsRejected() {
+ AlibabaEventBridgeEndpoint endpoint = new AlibabaEventBridgeEndpoint();
+ endpoint.setRegion("cn-hangzhou");
+ endpoint.setAccessKey("accessKey");
+ endpoint.setSecretKey("secretKey");
+
+ assertThatThrownBy(() ->
AlibabaEventBridgeUtils.createClient(endpoint))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage("Endpoint is required");
+ }
+
+ @Test
+ void anEndpointWithoutARegionCreatesAClient() {
+ AlibabaEventBridgeEndpoint endpoint = new AlibabaEventBridgeEndpoint();
+ endpoint.setEndpoint("12345.eventbridge.cn-hangzhou.aliyuncs.com");
+ endpoint.setAccessKey("accessKey");
+ endpoint.setSecretKey("secretKey");
+
+ EventBridgeClient client =
AlibabaEventBridgeUtils.createClient(endpoint);
+
+
assertThat(client._endpoint).isEqualTo("12345.eventbridge.cn-hangzhou.aliyuncs.com");
+ assertThat(client._regionId).isNull();
+ }
+}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index edcf9cdd8574..ed04cb27562b 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -6121,6 +6121,18 @@ checked at all. A consumer with `needClientAuth=true`
and the option set now acc
instead of rejecting all of them. Consumers that share a server through
`nettySharedHttpServer` never applied the
option, and are unchanged. The option still verifies the host on a
`netty-http` producer.
+=== camel-alibaba-eventbridge - endpoint is marked as required instead of
region
+
+The `endpoint` option of `alibaba-eventbridge` is now marked as required, and
the `region` option no longer is. The
+client of the SDK needs the endpoint, and the region does not determine it.
+
+The endpoint validation of the catalog now reports a URI without `endpoint` as
missing a required option. Before, it
+reported a URI without `region`. It also reports a URI without `endpoint` when
the `eventBridgeClient` option is set
+or autowired. Such a route still runs, because the producer then uses neither
option.
+
+A URI with `region` and without `endpoint` already failed at the first
message, unless a client was set or autowired.
+It now fails with `Endpoint is required` instead of `'endpoint' can not be
unset` from the SDK.
+
=== camel-alibaba-oss - a listed object that cannot be got is skipped
When the consumer lists the bucket, a failure to get one of the listed objects
(for example access denied, or an
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AlibabaEventBridgeEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AlibabaEventBridgeEndpointBuilderFactory.java
index 77824c4af4ba..e1f8f3606900 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AlibabaEventBridgeEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AlibabaEventBridgeEndpointBuilderFactory.java
@@ -76,6 +76,7 @@ public interface AlibabaEventBridgeEndpointBuilderFactory {
*
* The option is a: <code>java.lang.String</code> type.
*
+ * Required: true
* Group: producer
*
* @param endpoint the value to set
@@ -170,7 +171,6 @@ public interface AlibabaEventBridgeEndpointBuilderFactory {
*
* The option is a: <code>java.lang.String</code> type.
*
- * Required: true
* Group: producer
*
* @param region the value to set
@@ -594,6 +594,20 @@ public interface AlibabaEventBridgeEndpointBuilderFactory {
*/
public static final AlibabaEventBridgeHeaderNameBuilder INSTANCE = new
AlibabaEventBridgeHeaderNameBuilder();
+ /**
+ * The operation that the producer performs. This header replaces the
+ * operation option. If this header is not set, an exchange property of
+ * the same name replaces the operation option.
+ *
+ * The option is a: {@code String} type.
+ *
+ * Group: producer
+ *
+ * @return the name of the header {@code AlibabaEventBridgeOperation}.
+ */
+ public String alibabaEventBridgeOperation() {
+ return "CamelAlibabaEventBridgeOperation";
+ }
/**
* The name of the event bus for a JSON text or Map body. This header
* replaces the eventBusName option. If this header is not set, an