atiaomar1978-hub commented on code in PR #25552:
URL: https://github.com/apache/camel/pull/25552#discussion_r3817033971
##########
components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeUtils.java:
##########
@@ -99,11 +100,13 @@ private static CloudEvent toCloudEvent(Object body,
ClientConfigurations configu
}
if (body instanceof Map<?, ?> mapBody) {
- String eventBusName = stringValue(mapBody.get("eventBusName"),
configuration.getEventBusName());
- String source = stringValue(mapBody.get("source"),
configuration.getEventSource());
- String type = stringValue(mapBody.get("type"),
configuration.getEventType());
- String subject = stringValue(mapBody.get("subject"),
configuration.getEventSubject());
- String data = jsonDataValue(mapBody.get("data"));
+ String eventBusName
+ =
stringValue(mapBody.get(AlibabaEventBridgeConstants.EVENT_BUS_NAME),
configuration.getEventBusName());
+ String source =
stringValue(mapBody.get(AlibabaEventBridgeConstants.EVENT_SOURCE),
configuration.getEventSource());
Review Comment:
**Map body keys renamed — document this**
Previous Map keys were CloudEvents-short (`source`, `type`, `subject`,
`data`); now aligned with URI params (`eventSource`, `eventType`,
`eventSubject`, `eventData`). Fine for unreleased Preview, but please document
the Map body schema in the component guide.
##########
components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/constants/AlibabaEventBridgeConstants.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * 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.constants;
+
+import org.apache.camel.spi.Metadata;
+
+public final class AlibabaEventBridgeConstants {
+
+ @Metadata(label = "producer", description = "Event bus name override",
javaType = "String")
+ public static final String EVENT_BUS_NAME = "eventBusName";
+
+ @Metadata(label = "producer", description = "Event source override",
javaType = "String")
+ public static final String EVENT_SOURCE = "eventSource";
+
+ @Metadata(label = "producer", description = "Event type override",
javaType = "String")
+ public static final String EVENT_TYPE = "eventType";
+
+ @Metadata(label = "producer", description = "Event subject override",
javaType = "String")
+ public static final String EVENT_SUBJECT = "eventSubject";
+
+ @Metadata(label = "producer", description = "Event data override",
javaType = "String")
+ public static final String EVENT_DATA = "eventData";
+
+ @Metadata(label = "producer", description = "Event request identifier",
javaType = "String")
+ public static final String EVENT_RESPONSE_REQUEST_IDENTIFIER = "requestId";
+
+ @Metadata(label = "producer", description = "Event resource owner account
identifier", javaType = "String")
+ public static final String
EVENT_RESPONSE_RESOURCE_OWNER_ACCOUNT_IDENTIFIER = "resourceOwnerAccountId";
+
+ @Metadata(label = "producer", description = "Event failed entry count",
javaType = "String")
Review Comment:
**`@Metadata` javaType mismatch**
`EVENT_RESPONSE_FAILED_ENTRY_COUNT` stores an `Integer` from
`getFailedEntryCount()`. `EVENT_RESPONSE_ENTRY_LIST` is a
`List<Map<String,Object>>`, not a `String`. Please fix `javaType` for catalog
accuracy.
##########
components/camel-alibaba/camel-alibaba-eventbridge/src/test/java/org/apache/camel/component/alibaba/eventbridge/PutEventsTest.java:
##########
@@ -100,10 +101,10 @@ void testPutEventsWithMapBody() throws Exception {
mock.expectedMinimumMessageCount(1);
Map<String, Object> event = new HashMap<>();
- event.put("eventBusName",
testConfiguration.getProperty("eventBusName"));
- event.put("source", testConfiguration.getProperty("eventSource"));
- event.put("type", testConfiguration.getProperty("eventType"));
- event.put("data", Map.of("key", "value"));
+ event.put(AlibabaEventBridgeConstants.EVENT_BUS_NAME,
testConfiguration.getProperty("eventBusName"));
Review Comment:
**Tests updated correctly**
Map body test now uses `AlibabaEventBridgeConstants` keys. Minor gap: no
coverage for `eventSubject` override or multi-event list body — non-blocking
for this refactor.
##########
components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/constants/AlibabaEventBridgeHeaders.java:
##########
@@ -18,23 +18,23 @@
import org.apache.camel.spi.Metadata;
-public final class AlibabaEventBridgeHeaders {
+public sealed class AlibabaEventBridgeHeaders permits
AlibabaEventBridgeProperties {
Review Comment:
**Sealed hierarchy — consider consistency**
Sealed `Headers` → `Properties` deduplicates exchange keys nicely. Other
Alibaba modules (OSS, KMS, SMS) use separate `final` classes. Worth aligning
across CAMEL-24373 if a convention is emerging.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]