From 9420e1391915bb60c27d6534b3bd4d632ac34ab0 Mon Sep 17 00:00:00 2001 From: 3y Date: Wed, 13 Apr 2022 19:52:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A3=E4=BB=BB=E9=93=BE=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=20=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java3y/austin/handler/pending/Task.java | 5 +- .../impl/action/AfterParamCheckAction.java | 2 + .../api/impl/action/AssembleAction.java | 2 + .../api/impl/action/PreParamCheckAction.java | 2 + .../service/api/impl/action/SendMqAction.java | 2 + .../api/impl/config/PipelineConfig.java | 65 ++++--------------- 6 files changed, 24 insertions(+), 54 deletions(-) diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/pending/Task.java b/austin-handler/src/main/java/com/java3y/austin/handler/pending/Task.java index 9190040..eb5f1af 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/pending/Task.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/pending/Task.java @@ -18,8 +18,9 @@ import org.springframework.stereotype.Component; /** * Task 执行器 * 0.丢弃消息 - * 1.通用去重功能 - * 2.发送消息 + * 2.屏蔽消息 + * 2.通用去重功能 + * 3.发送消息 * * @author 3y */ diff --git a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AfterParamCheckAction.java b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AfterParamCheckAction.java index 39216ba..8c97488 100644 --- a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AfterParamCheckAction.java +++ b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AfterParamCheckAction.java @@ -13,6 +13,7 @@ import com.java3y.austin.service.api.impl.domain.SendTaskModel; import com.java3y.austin.support.pipeline.BusinessProcess; import com.java3y.austin.support.pipeline.ProcessContext; import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; import java.util.Iterator; import java.util.List; @@ -25,6 +26,7 @@ import java.util.stream.Collectors; * 后置参数检查 */ @Slf4j +@Service public class AfterParamCheckAction implements BusinessProcess { diff --git a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AssembleAction.java b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AssembleAction.java index 7114bc4..815e838 100644 --- a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AssembleAction.java +++ b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AssembleAction.java @@ -21,6 +21,7 @@ import com.java3y.austin.support.utils.ContentHolderUtil; import com.java3y.austin.support.utils.TaskInfoUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import java.lang.reflect.Field; import java.util.*; @@ -31,6 +32,7 @@ import java.util.*; * @description 拼装参数 */ @Slf4j +@Service public class AssembleAction implements BusinessProcess { @Autowired diff --git a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/PreParamCheckAction.java b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/PreParamCheckAction.java index 794e1d9..2c1d152 100644 --- a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/PreParamCheckAction.java +++ b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/PreParamCheckAction.java @@ -9,6 +9,7 @@ import com.java3y.austin.service.api.impl.domain.SendTaskModel; import com.java3y.austin.support.pipeline.BusinessProcess; import com.java3y.austin.support.pipeline.ProcessContext; import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; import java.util.List; import java.util.stream.Collectors; @@ -19,6 +20,7 @@ import java.util.stream.Collectors; * @description 前置参数校验 */ @Slf4j +@Service public class PreParamCheckAction implements BusinessProcess { @Override diff --git a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/SendMqAction.java b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/SendMqAction.java index 8bb27df..8a4ad69 100644 --- a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/SendMqAction.java +++ b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/SendMqAction.java @@ -13,12 +13,14 @@ import com.java3y.austin.support.utils.KafkaUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; /** * @author 3y * 将消息发送到MQ */ @Slf4j +@Service public class SendMqAction implements BusinessProcess { @Autowired diff --git a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/config/PipelineConfig.java b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/config/PipelineConfig.java index 5639735..662888b 100644 --- a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/config/PipelineConfig.java +++ b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/config/PipelineConfig.java @@ -6,15 +6,15 @@ import com.java3y.austin.service.api.impl.action.AfterParamCheckAction; import com.java3y.austin.service.api.impl.action.AssembleAction; import com.java3y.austin.service.api.impl.action.PreParamCheckAction; import com.java3y.austin.service.api.impl.action.SendMqAction; +import com.java3y.austin.service.api.impl.domain.SendTaskModel; import com.java3y.austin.support.pipeline.BusinessProcess; import com.java3y.austin.support.pipeline.ProcessController; import com.java3y.austin.support.pipeline.ProcessTemplate; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; +import java.util.*; /** * api层的pipeline配置类 @@ -23,6 +23,14 @@ import java.util.Map; @Configuration public class PipelineConfig { + @Autowired + private PreParamCheckAction preParamCheckAction; + @Autowired + private AssembleAction assembleAction; + @Autowired + private AfterParamCheckAction afterParamCheckAction; + @Autowired + private SendMqAction sendMqAction; /** * 普通发送执行流程 @@ -35,14 +43,8 @@ public class PipelineConfig { @Bean("commonSendTemplate") public ProcessTemplate commonSendTemplate() { ProcessTemplate processTemplate = new ProcessTemplate(); - ArrayList processList = new ArrayList<>(); - - processList.add(preParamCheckAction()); - processList.add(assembleAction()); - processList.add(afterParamCheckAction()); - processList.add(sendMqAction()); - - processTemplate.setProcessList(processList); + processTemplate.setProcessList(Arrays.asList(preParamCheckAction, assembleAction, + afterParamCheckAction, sendMqAction)); return processTemplate; } @@ -62,45 +64,4 @@ public class PipelineConfig { return processController; } - - /** - * 组装参数Action - * - * @return - */ - @Bean - public AssembleAction assembleAction() { - return new AssembleAction(); - } - - /** - * 前置参数校验Action - * - * @return - */ - @Bean - public PreParamCheckAction preParamCheckAction() { - return new PreParamCheckAction(); - } - - /** - * 后置参数校验Action - * - * @return - */ - @Bean - public AfterParamCheckAction afterParamCheckAction() { - return new AfterParamCheckAction(); - } - - /** - * 发送消息至MQ的Action - * - * @return - */ - @Bean - public SendMqAction sendMqAction() { - return new SendMqAction(); - } - }