This is an automated email from the ASF dual-hosted git repository.

jonyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 986e3c184 Revert "Used isEmpty() instead of making comparison" (#2944)
986e3c184 is described below

commit 986e3c184083d0f4c056b9ae2877626ee9e10421
Author: jonyangx <[email protected]>
AuthorDate: Sat Jan 28 19:38:52 2023 +0800

    Revert "Used isEmpty() instead of making comparison" (#2944)
    
    * Revert "Used CollectionUtils.isempty to check null value (#2936)"
    
    This reverts commit 03e84a34002ff22fc326e9ded085678dbb0d2837.
    
    * fix build error
    
    * fix issue2945
    
    ---------
    
    Co-authored-by: jonyangx <[email protected]>
---
 .../client/grpc/producer/CloudEventProducer.java   | 37 +++++++++++-----------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git 
a/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/CloudEventProducer.java
 
b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/CloudEventProducer.java
index 261d6d4d7..6b73c47f6 100644
--- 
a/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/CloudEventProducer.java
+++ 
b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/CloudEventProducer.java
@@ -42,7 +42,7 @@ import io.cloudevents.CloudEvent;
 import io.cloudevents.core.builder.CloudEventBuilder;
 
 public class CloudEventProducer {
-    
+
     private static final Logger logger = 
LoggerFactory.getLogger(CloudEventProducer.class);
 
     private static final String PROTOCOL_TYPE = 
EventMeshCommon.CLOUD_EVENTS_PROTOCOL_NAME;
@@ -57,14 +57,13 @@ public class CloudEventProducer {
     }
 
     public Response publish(List<CloudEvent> events) {
-        logger.info("BatchPublish message, batch size=" + events.size());
-
         if (CollectionUtils.isEmpty(events)) {
             return null;
         }
+        
         List<CloudEvent> enhancedEvents = events.stream()
-            .map(event -> enhanceCloudEvent(event, null))
-            .collect(Collectors.toList());
+                .map(event -> enhanceCloudEvent(event, null))
+                .collect(Collectors.toList());
 
         BatchMessage enhancedMessage = 
EventMeshClientUtil.buildBatchMessages(enhancedEvents, clientConfig, 
PROTOCOL_TYPE);
         try {
@@ -116,20 +115,20 @@ public class CloudEventProducer {
 
     private CloudEvent enhanceCloudEvent(final CloudEvent cloudEvent, String 
timeout) {
         CloudEventBuilder builder = CloudEventBuilder.from(cloudEvent)
-            .withExtension(ProtocolKey.ENV, clientConfig.getEnv())
-            .withExtension(ProtocolKey.IDC, clientConfig.getIdc())
-            .withExtension(ProtocolKey.IP, IPUtils.getLocalAddress())
-            .withExtension(ProtocolKey.PID, 
Long.toString(ThreadUtils.getPID()))
-            .withExtension(ProtocolKey.SYS, clientConfig.getSys())
-            .withExtension(ProtocolKey.LANGUAGE, Constants.LANGUAGE_JAVA)
-            .withExtension(ProtocolKey.PROTOCOL_TYPE, PROTOCOL_TYPE)
-            .withExtension(ProtocolKey.PROTOCOL_DESC, Constants.PROTOCOL_GRPC)
-            .withExtension(ProtocolKey.PROTOCOL_VERSION, 
cloudEvent.getSpecVersion().toString())
-            .withExtension(ProtocolKey.UNIQUE_ID, 
RandomStringUtils.generateNum(30))
-            .withExtension(ProtocolKey.SEQ_NUM, 
RandomStringUtils.generateNum(30))
-            .withExtension(ProtocolKey.USERNAME, clientConfig.getUserName())
-            .withExtension(ProtocolKey.PASSWD, clientConfig.getPassword())
-            .withExtension(ProtocolKey.PRODUCERGROUP, 
clientConfig.getProducerGroup());
+                .withExtension(ProtocolKey.ENV, clientConfig.getEnv())
+                .withExtension(ProtocolKey.IDC, clientConfig.getIdc())
+                .withExtension(ProtocolKey.IP, IPUtils.getLocalAddress())
+                .withExtension(ProtocolKey.PID, 
Long.toString(ThreadUtils.getPID()))
+                .withExtension(ProtocolKey.SYS, clientConfig.getSys())
+                .withExtension(ProtocolKey.LANGUAGE, Constants.LANGUAGE_JAVA)
+                .withExtension(ProtocolKey.PROTOCOL_TYPE, PROTOCOL_TYPE)
+                .withExtension(ProtocolKey.PROTOCOL_DESC, 
Constants.PROTOCOL_GRPC)
+                .withExtension(ProtocolKey.PROTOCOL_VERSION, 
cloudEvent.getSpecVersion().toString())
+                .withExtension(ProtocolKey.UNIQUE_ID, 
RandomStringUtils.generateNum(30))
+                .withExtension(ProtocolKey.SEQ_NUM, 
RandomStringUtils.generateNum(30))
+                .withExtension(ProtocolKey.USERNAME, 
clientConfig.getUserName())
+                .withExtension(ProtocolKey.PASSWD, clientConfig.getPassword())
+                .withExtension(ProtocolKey.PRODUCERGROUP, 
clientConfig.getProducerGroup());
 
         if (timeout != null) {
             builder.withExtension(Constants.EVENTMESH_MESSAGE_CONST_TTL, 
timeout);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to