davsclaus commented on code in PR #25474:
URL: https://github.com/apache/camel/pull/25474#discussion_r3772624161


##########
components/camel-alibaba/camel-alibaba-common/pom.xml:
##########
@@ -41,6 +41,12 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-support</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>tea-openapi</artifactId>

Review Comment:
   **Important — common module SDK dependency:** Phase 1 review explicitly 
flagged that `camel-alibaba-common` should not pull in SDK-specific 
dependencies (the OSS SDK was moved out of common). Adding `tea-openapi` here 
means that the Phase 1 components (`camel-alibaba-oss`, `camel-alibaba-mns`) 
now transitively get `tea-openapi` even though they don't use it.
   
   `tea-openapi` is used by FC, SMS, and KMS but NOT by EventBridge, OSS, or 
MNS (3 of 6 components). Consider whether `OpenApiClientSupport` and this 
dependency should live in a separate shared module, or whether each component 
should declare `tea-openapi` directly.



##########
components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/EventBridgeProducer.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * 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 java.util.List;
+
+import com.aliyun.eventbridge.EventBridgeClient;
+import com.aliyun.eventbridge.models.CloudEvent;
+import com.aliyun.eventbridge.models.PutEventsResponse;
+import org.apache.camel.Exchange;
+import 
org.apache.camel.component.alibaba.eventbridge.constants.EventBridgeOperations;
+import 
org.apache.camel.component.alibaba.eventbridge.constants.EventBridgeProperties;
+import 
org.apache.camel.component.alibaba.eventbridge.models.ClientConfigurations;
+import org.apache.camel.support.DefaultProducer;
+import org.apache.camel.util.ObjectHelper;
+
+public class EventBridgeProducer extends DefaultProducer {
+
+    private EventBridgeClient eventBridgeClient;
+
+    public EventBridgeProducer(EventBridgeEndpoint endpoint) {
+        super(endpoint);
+    }
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        EventBridgeEndpoint endpoint = getEndpoint();
+        ClientConfigurations configuration = 
EventBridgeUtils.createClientConfigurations(endpoint, exchange);
+
+        if (ObjectHelper.isEmpty(configuration.getOperation())) {
+            throw new IllegalArgumentException("Operation name not found");
+        }
+
+        if (eventBridgeClient == null) {
+            eventBridgeClient = endpoint.initClient();
+        }
+
+        switch (configuration.getOperation()) {
+            case EventBridgeOperations.PUT_EVENTS -> putEvents(exchange, 
configuration);
+            default -> throw new UnsupportedOperationException("Unsupported 
operation: " + configuration.getOperation());
+        }
+    }
+
+    private void putEvents(Exchange exchange, ClientConfigurations 
configuration) {
+        List<CloudEvent> events = 
EventBridgeUtils.resolveCloudEvents(exchange, configuration);
+        if (events.isEmpty()) {
+            throw new IllegalArgumentException("At least one event is required 
for putEvents");
+        }
+
+        PutEventsResponse response = eventBridgeClient.putEvents(events);
+        
exchange.getMessage().setBody(EventBridgeUtils.toPutEventsMap(response));
+        if (ObjectHelper.isNotEmpty(response.getRequestId())) {
+            exchange.setProperty(EventBridgeProperties.REQUEST_ID, 
response.getRequestId());
+        }

Review Comment:
   **Moderate — exchange property vs header:** All 4 producers set `REQUEST_ID` 
via `exchange.setProperty(...)`. Camel convention is to set response metadata 
in message headers (`exchange.getMessage().setHeader(...)`). Exchange 
properties are for cross-route/routing-level decisions, not response metadata.
   
   This applies to all 4 producers:
   - `EventBridgeProducer.java`
   - `FCProducer.java`
   - `KMSProducer.java`
   - `SMSProducer.java`
   
   Consider using `exchange.getMessage().setHeader(...)` instead, consistent 
with how most Camel components report response metadata.



##########
components/camel-alibaba/camel-alibaba-kms/src/test/java/org/apache/camel/component/alibaba/kms/EncryptTest.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.kms;
+
+import java.util.Map;
+
+import java.util.Base64;

Review Comment:
   **Minor — import ordering:** There is a spurious blank line between two 
`java.util` imports, and `Base64` should come before `Map` alphabetically.
   
   ```suggestion
   import java.util.Base64;
   import java.util.Map;
   ```



##########
components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/EventBridgeUtils.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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 java.net.URI;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.aliyun.eventbridge.EventBridgeClient;
+import com.aliyun.eventbridge.models.CloudEvent;
+import com.aliyun.eventbridge.models.Config;
+import com.aliyun.eventbridge.models.PutEventsResponse;
+import com.aliyun.eventbridge.models.PutEventsResponseEntry;
+import com.aliyun.eventbridge.util.EventBuilder;
+import com.google.gson.Gson;
+import org.apache.camel.Exchange;

Review Comment:
   **Moderate — transitive Gson dependency:** `com.google.gson.Gson` is used 
here but not declared as an explicit dependency in the EventBridge `pom.xml`. 
It's transitively available from the `eventbridge-client` SDK, but this is 
fragile — if the SDK stops bundling Gson in a future version, the build will 
break.
   
   Either add an explicit `<dependency>` for Gson in the module's `pom.xml`, or 
use an alternative serialization approach that doesn't rely on a transitive 
dependency.



##########
components/camel-alibaba/camel-alibaba-fc/src/test/java/org/apache/camel/component/alibaba/fc/InvokeFunctionTest.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.fc;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;

Review Comment:
   **Minor:** Unused import — `java.util.Base64` is imported but never 
referenced in this test class.
   
   ```suggestion
   ```



##########
tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java:
##########
@@ -961,6 +961,7 @@ private Set<String> executeOthers() throws Exception {
                 case "camel-google-common":
                 case "camel-http-base":
                 case "camel-http-common":
+                case "camel-alibaba":
                 case "camel-huawei":

Review Comment:
   **Moderate — alphabetical ordering:** `case "camel-alibaba":` is inserted 
after `"camel-http-common"` but should come earlier in alphabetical order 
(before `"camel-google-common"`).
   
   ```suggestion
                   case "camel-alibaba":
                   case "camel-google-common":
   ```
   
   (Move the `camel-alibaba` case to just before the existing 
`camel-google-common` line, or wherever alphabetical order places it in the 
full list.)



-- 
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]

Reply via email to