fabian4 commented on code in PR #4229:
URL: https://github.com/apache/eventmesh/pull/4229#discussion_r1266628097


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/MessageTransferTask.java:
##########
@@ -181,25 +181,20 @@ public void run() {
 
     private CloudEvent addTimestamp(CloudEvent event, Command cmd, long 
sendTime) {
         if (cmd == RESPONSE_TO_SERVER) {
-            event = CloudEventBuilder.from(event)
-                .withExtension(EventMeshConstants.RSP_C2EVENTMESH_TIMESTAMP,
-                    String.valueOf(startTime))
-                .withExtension(EventMeshConstants.RSP_EVENTMESH2MQ_TIMESTAMP,
-                    String.valueOf(sendTime))
-                .withExtension(EventMeshConstants.RSP_SEND_EVENTMESH_IP,
-                    
eventMeshTCPServer.getEventMeshTCPConfiguration().getEventMeshServerIp())
-                .build();
+            return getCloudEvent(event, sendTime, 
EventMeshConstants.RSP_C2EVENTMESH_TIMESTAMP, 
EventMeshConstants.RSP_EVENTMESH2MQ_TIMESTAMP,
+                EventMeshConstants.RSP_SEND_EVENTMESH_IP);
         } else {
-            event = CloudEventBuilder.from(event)
-                .withExtension(EventMeshConstants.REQ_C2EVENTMESH_TIMESTAMP,
-                    String.valueOf(startTime))
-                .withExtension(EventMeshConstants.REQ_EVENTMESH2MQ_TIMESTAMP,
-                    String.valueOf(sendTime))
-                .withExtension(EventMeshConstants.REQ_SEND_EVENTMESH_IP,
-                    
eventMeshTCPServer.getEventMeshTCPConfiguration().getEventMeshServerIp())
-                .build();
+            return getCloudEvent(event, sendTime, 
EventMeshConstants.REQ_C2EVENTMESH_TIMESTAMP, 
EventMeshConstants.REQ_EVENTMESH2MQ_TIMESTAMP,
+                EventMeshConstants.REQ_SEND_EVENTMESH_IP);

Review Comment:
   Do you mean like this?
   
   ```java
   private CloudEvent addTimestamp(CloudEvent event, Command cmd, long 
sendTime) {
         if (cmd == RESPONSE_TO_SERVER) {
             return getCloudEvent(event, sendTime,
                 EventMeshConstants.RSP_C2EVENTMESH_TIMESTAMP,
                 EventMeshConstants.RSP_EVENTMESH2MQ_TIMESTAMP,
                 EventMeshConstants.RSP_SEND_EVENTMESH_IP);
         } else {
             return getCloudEvent(event, sendTime,
                 EventMeshConstants.REQ_C2EVENTMESH_TIMESTAMP,
                 EventMeshConstants.REQ_EVENTMESH2MQ_TIMESTAMP,
                 EventMeshConstants.REQ_SEND_EVENTMESH_IP);
         }
     }
   ```



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


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

Reply via email to