atiaomar1978-hub commented on code in PR #25474:
URL: https://github.com/apache/camel/pull/25474#discussion_r3776106789


##########
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:
   Fixed in `43b5d17`: all four Phase 2 producers now set REQUEST_ID on message 
headers instead of exchange properties.



##########
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:
   Fixed in `43b5d17`: added explicit `gson` dependency to 
`camel-alibaba-eventbridge/pom.xml`.



##########
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:
   Fixed in `43b5d17`: moved `case "camel-alibaba":` before 
`camel-google-common` in alphabetical order.



##########
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:
   Fixed in `43b5d17`: corrected import ordering.



##########
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:
   Fixed in `43b5d17`: removed unused `Base64` import.



##########
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:
   Fixed in `43b5d17`: removed `tea-openapi` from `camel-alibaba-common`. Tea 
Config creation now lives in FC/SMS/KMS utils only.



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