pandaapo commented on code in PR #4578:
URL: https://github.com/apache/eventmesh/pull/4578#discussion_r1404377403


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendAsyncEventProcessor.java:
##########
@@ -237,41 +241,53 @@ public void handler(final HandlerService.HandlerSpecific 
handlerSpecific, final
         eventMeshHTTPServer.getMetrics().getSummaryMetrics().recordSendMsg();
 
         final long startTime = System.currentTimeMillis();
-
+        boolean isFiltered = true;
         try {
             event = CloudEventBuilder.from(sendMessageContext.getEvent())
                 .withExtension(EventMeshConstants.REQ_EVENTMESH2MQ_TIMESTAMP, 
String.valueOf(System.currentTimeMillis()))
                 .build();
             
handlerSpecific.getTraceOperation().createClientTraceOperation(EventMeshUtil.getCloudEventExtensionMap(SpecVersion.V1.toString(),
 event),
                 EventMeshTraceConstants.TRACE_UPSTREAM_EVENTMESH_CLIENT_SPAN, 
false);
+            if (filterPattern != null) {
+                isFiltered = 
filterPattern.filter(JsonUtils.toJSONString(event));
+            }
 
-            eventMeshProducer.send(sendMessageContext, new SendCallback() {
-
-                @Override
-                public void onSuccess(final SendResult sendResult) {
-                    responseBodyMap.put(EventMeshConstants.RET_CODE, 
EventMeshRetCode.SUCCESS.getRetCode());
-                    responseBodyMap.put(EventMeshConstants.RET_MSG, 
EventMeshRetCode.SUCCESS.getErrMsg() + sendResult);
-
-                    LogUtils.info(log, 
"message|eventMesh2mq|REQ|ASYNC|send2MQCost={}ms|topic={}|bizSeqNo={}|uniqueId={}",
-                        System.currentTimeMillis() - startTime, topic, bizNo, 
uniqueId);
-                    
handlerSpecific.getTraceOperation().endLatestTrace(sendMessageContext.getEvent());
-                    handlerSpecific.sendResponse(responseHeaderMap, 
responseBodyMap);
-                }
+            if (isFiltered) {
+                eventMeshProducer.send(sendMessageContext, new SendCallback() {

Review Comment:
   I don't quite understand this point. Is it necessary for producers to set 
filtering rules when sending messages?
   
   这一点没太明白,生产者发送消息有必要设置过滤规则吗?



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