xwm1992 commented on code in PR #4578:
URL: https://github.com/apache/eventmesh/pull/4578#discussion_r1405335616
##########
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:
Currently, the settings of filtering rules are retained to ensure that if
there is a need for the sender to use filtering rules in the future.
---
目前是都保留了过滤规则的设置,确保后续如果有发送方的使用过滤规则的需求。
##########
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:
Currently, the settings of filtering rules are retained to ensure that if
there is a need for the sender to use filtering rules in the future.
---
目前是都保留了过滤规则的设置,确保后续如果有发送方的使用过滤规则的需求。
--
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]