Merge branch 'feature/remove_variables' into dev
This commit is contained in:
commit
6504e4a7ca
@ -19,8 +19,9 @@ public class MqLogEvent extends ApplicationEvent {
|
||||
private String messageBody;
|
||||
private String traceId;
|
||||
private MqLogEventType eventType;
|
||||
private String targetType;
|
||||
|
||||
public MqLogEvent(String uniqueId, String messageId, String mqTag, String mqKey, String messageBody, String traceId, MqLogEventType eventType) {
|
||||
public MqLogEvent(String uniqueId, String messageId, String mqTag, String mqKey, String messageBody, String traceId, MqLogEventType eventType, String targetType) {
|
||||
super(uniqueId);
|
||||
this.uniqueId = uniqueId;
|
||||
this.messageId = messageId;
|
||||
@ -29,6 +30,7 @@ public class MqLogEvent extends ApplicationEvent {
|
||||
this.messageBody = messageBody;
|
||||
this.traceId = traceId;
|
||||
this.eventType = eventType;
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
public String getUniqueId() {
|
||||
@ -86,4 +88,12 @@ public class MqLogEvent extends ApplicationEvent {
|
||||
public void setEventType(MqLogEventType eventType) {
|
||||
this.eventType = eventType;
|
||||
}
|
||||
|
||||
public String getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public void setTargetType(String targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import cn.axzo.workflow.core.service.ExtAxMqLogService;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -34,6 +35,10 @@ public class MqLogListener implements ApplicationListener<MqLogEvent> {
|
||||
if (!refreshProperties.getMqLogEnable()) {
|
||||
return;
|
||||
}
|
||||
if (!ListUtils.emptyIfNull(refreshProperties.getSupportedMqLogProcessDefinitionKeys()).contains(event.getTargetType())) {
|
||||
log.info("mq_log_process_definition_not_found: {}", event.getTargetType());
|
||||
return;
|
||||
}
|
||||
switch (event.getEventType()) {
|
||||
case INSERT:
|
||||
insert(buildMqLogEntity(event));
|
||||
|
||||
@ -86,7 +86,7 @@ public class RocketMqEventConfiguration {
|
||||
MqLogEvent mqLogEvent = new MqLogEvent(event.getEventId(), null,
|
||||
event.getEventName(), event.getShardingKey(),
|
||||
event.toPrettyJsonString(), TraceUtils.getOrCreateTraceId(),
|
||||
MqLogEventType.INSERT);
|
||||
MqLogEventType.INSERT, event.getTargetType());
|
||||
log.info("mq_send_Before: {}, uniqueId: {}", event.getShardingKey(), event.getEventId());
|
||||
applicationEventPublisher.publishEvent(mqLogEvent);
|
||||
};
|
||||
@ -105,7 +105,7 @@ public class RocketMqEventConfiguration {
|
||||
MqLogEvent mqLogEvent = new MqLogEvent(event.getEventId(), messageId,
|
||||
event.getEventName(), event.getShardingKey(),
|
||||
event.toPrettyJsonString(), TraceUtils.getOrCreateTraceId(),
|
||||
MqLogEventType.UPDATE);
|
||||
MqLogEventType.UPDATE, event.getTargetType());
|
||||
log.info("mq_send_after: {}, uniqueId: {}, messageId: {}", event.getShardingKey(), event.getEventId(), messageId);
|
||||
applicationEventPublisher.publishEvent(mqLogEvent);
|
||||
};
|
||||
@ -122,7 +122,7 @@ public class RocketMqEventConfiguration {
|
||||
return (event, context) -> {
|
||||
MqLogEvent mqLog = new MqLogEvent(event.getEventId(), null, event.getEventName(),
|
||||
event.getShardingKey(), event.toPrettyJsonString(), TraceUtils.getOrCreateTraceId(),
|
||||
MqLogEventType.DELETE);
|
||||
MqLogEventType.DELETE, event.getTargetType());
|
||||
log.info("mq_transaction_rollback: {}, uniqueId: {}", event.getShardingKey(), event.getEventId());
|
||||
applicationEventPublisher.publishEvent(mqLog);
|
||||
};
|
||||
|
||||
@ -26,6 +26,8 @@ public class SupportRefreshProperties {
|
||||
|
||||
@Value("${workflow.mqLog.enable: false}")
|
||||
private Boolean mqLogEnable;
|
||||
@Value("${workflow.mqLog.supportedProcessDefinitionKeys:}")
|
||||
private List<String> supportedMqLogProcessDefinitionKeys;
|
||||
|
||||
@Value("${workflow.apiLog.filterApiType:}")
|
||||
private String filterApiType;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user