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


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/task/MessageTransferTask.java:
##########
@@ -181,27 +181,23 @@ 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();
+            event = getCloudEvent(event, sendTime, 
EventMeshConstants.RSP_C2EVENTMESH_TIMESTAMP, 
EventMeshConstants.RSP_EVENTMESH2MQ_TIMESTAMP,
+                EventMeshConstants.RSP_SEND_EVENTMESH_IP);

Review Comment:
   If a method's input parameters do not require any reassignment logic, it is 
not recommended to use them as left-hand values for reassignment. Typically, it 
is better to use a new variable as the return value, which will make the logic 
clearer. In this case, there is no necessity to define a new variable, so you 
can directly return the return value of the `getCloudEvent` method.



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