update(REQ-2516) - 完善日志打印
This commit is contained in:
parent
2a6306a2ff
commit
933768dfe5
@ -15,6 +15,11 @@
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>workflow-engine-api</artifactId>
|
||||
|
||||
@ -10,7 +10,7 @@ import cn.axzo.workflow.starter.common.condition.NonContainerEnvironmentConditio
|
||||
import cn.axzo.workflow.starter.handler.filter.global.BroadcastMessageQueueFilter;
|
||||
import cn.axzo.workflow.starter.mq.broadcast.consumer.WorkflowEngineBroadcastEventListener;
|
||||
import cn.axzo.workflow.starter.mq.broadcast.consumer.WorkflowListener;
|
||||
import cn.axzo.workflow.starter.mq.broadcast.filter.InnerFilterDefinitionKeyInner;
|
||||
import cn.axzo.workflow.starter.mq.broadcast.filter.InnerFilterDefinitionKey;
|
||||
import cn.axzo.workflow.starter.mq.broadcast.filter.InnerFilterExtension;
|
||||
import cn.axzo.workflow.starter.mq.broadcast.filter.InnerFilterMQOwnerShip;
|
||||
import cn.axzo.workflow.starter.mq.broadcast.filter.InnerMessageQueueHandleBeforeFilter;
|
||||
@ -33,7 +33,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static cn.axzo.workflow.starter.StarterRPCInvokeMQConfiguration.DEFAULT_EVENT;
|
||||
@ -100,7 +99,7 @@ public class StarterBroadcastMQConfiguration {
|
||||
public void onMessage(MessageExt message) {
|
||||
for (InnerMessageQueueHandleBeforeFilter filter : filters) {
|
||||
if (filter.doFilter(message)) {
|
||||
log.info("message has been filtered");
|
||||
log.info("【{}】message has been filtered, messageId: {}", this.getClass().getSimpleName(), message.getMsgId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -111,7 +110,7 @@ public class StarterBroadcastMQConfiguration {
|
||||
public void afterPropertiesSet() {
|
||||
this.filters = ImmutableList.of(
|
||||
new InnerFilterMQOwnerShip(starterProperties, applicationName),
|
||||
new InnerFilterDefinitionKeyInner(starterProperties),
|
||||
new InnerFilterDefinitionKey(starterProperties),
|
||||
new InnerFilterExtension(businessFilterProvider));
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ public class StarterRPCInvokeMQConfiguration {
|
||||
@Override
|
||||
public void onMessage(MessageExt message) {
|
||||
if (filter.doFilter(message)) {
|
||||
log.info("message has been filtered");
|
||||
log.info("【{}】message has been filtered, messageId: {}", this.getClass().getSimpleName(), message.getMsgId());
|
||||
return;
|
||||
}
|
||||
super.onEvent(message, workflowEngineStarterEventConsumer);
|
||||
|
||||
@ -17,11 +17,11 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.MQ_OWNERSHIP_PROCES
|
||||
* @author wangli
|
||||
* @since 2024/6/4 17:06
|
||||
*/
|
||||
public class InnerFilterDefinitionKeyInner implements InnerMessageQueueHandleBeforeFilter {
|
||||
private final Logger log = LoggerFactory.getLogger(InnerFilterDefinitionKeyInner.class);
|
||||
public class InnerFilterDefinitionKey implements InnerMessageQueueHandleBeforeFilter {
|
||||
private final Logger log = LoggerFactory.getLogger(InnerFilterDefinitionKey.class);
|
||||
private final WorkflowEngineStarterProperties properties;
|
||||
|
||||
public InnerFilterDefinitionKeyInner(WorkflowEngineStarterProperties properties) {
|
||||
public InnerFilterDefinitionKey(WorkflowEngineStarterProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ public class InnerFilterDefinitionKeyInner implements InnerMessageQueueHandleBef
|
||||
return false;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(properties.getBroadcast().getFilterProcessDefinitionKeys())) {
|
||||
log.warn("Your system has the filter process-definition-key enabled, but `BroadcastListenerConfigurationProperties.filterProcessDefinitionKeys` is empty");
|
||||
log.warn("【{}】Your system has the filter process-definition-key enabled, but `BroadcastListenerConfigurationProperties.filterProcessDefinitionKeys` is empty", this.getClass().getSimpleName());
|
||||
return false;
|
||||
}
|
||||
Map<String, String> headers = message.getProperties();
|
||||
@ -39,7 +39,7 @@ public class InnerFilterDefinitionKeyInner implements InnerMessageQueueHandleBef
|
||||
if (properties.getBroadcast().getFilterProcessDefinitionKeys().contains(processDefinitionKey)) {
|
||||
return false;
|
||||
}
|
||||
log.info("The broadcast message does not belong to the key of interest, will be ignored. messageId: {}, message process-definition-key: {}", message.getMsgId(), processDefinitionKey);
|
||||
log.debug("【{}】The broadcast message does not belong to the key of interest, will be ignored. messageId: {}, message process-definition-key: {}", this.getClass().getSimpleName(), message.getMsgId(), processDefinitionKey);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -36,7 +36,7 @@ public class InnerFilterExtension implements InnerMessageQueueHandleBeforeFilter
|
||||
@Override
|
||||
public boolean doFilter(MessageExt message) {
|
||||
if (businessFilters.isEmpty()) {
|
||||
log.debug("business filter is empty");
|
||||
log.debug("【{}】business filter is empty", this.getClass().getSimpleName());
|
||||
return false;
|
||||
}
|
||||
for (BroadcastMessageQueueFilter businessFilter : businessFilters) {
|
||||
@ -45,18 +45,6 @@ public class InnerFilterExtension implements InnerMessageQueueHandleBeforeFilter
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
// for (BroadcastMessageQueueFilter businessFilter : businessFilters) {
|
||||
// Object payload = new String(message.getBody(), UTF_8);
|
||||
// Class<?> typeClass = getParameterizedTypeClass(businessFilter);
|
||||
// if(Objects.nonNull(typeClass)) {
|
||||
// payload = JSON.parseObject((String) payload, typeClass);
|
||||
// }
|
||||
// if (businessFilter.doFilter(message, payload)) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -35,10 +35,16 @@ public class InnerFilterMQOwnerShip implements InnerMessageQueueHandleBeforeFilt
|
||||
Map<String, String> headers = message.getProperties();
|
||||
String mqOwnerShip = headers.getOrDefault(MQ_OWNERSHIP_APPLICATION, null);
|
||||
|
||||
if (StringUtils.hasText(mqOwnerShip) && properties.getBroadcast().getFilterApplicationNames().contains(mqOwnerShip)) {
|
||||
if (!StringUtils.hasText(mqOwnerShip)) {
|
||||
log.debug("【{}】The broadcast message does not attribute the message, will not be ignored. messageId: {}", this.getClass().getSimpleName(), message.getMsgId());
|
||||
return false;
|
||||
} else {
|
||||
if (properties.getBroadcast().getFilterApplicationNames().contains(mqOwnerShip)) {
|
||||
return false;
|
||||
} else {
|
||||
log.debug("【{}】The broadcast message does not attribute the message, will be ignored. messageId: {}, mq-ownership-application: {}", this.getClass().getSimpleName(), message.getMsgId(), mqOwnerShip);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
log.info("The broadcast message does not attribute the message, will be ignored. messageId: {}, mq-ownership-application: {}", message.getMsgId(), mqOwnerShip);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user