diff --git a/Milkomeda/pom.xml b/Milkomeda/pom.xml index 6961e3ac..62660032 100644 --- a/Milkomeda/pom.xml +++ b/Milkomeda/pom.xml @@ -11,7 +11,7 @@ 1.8 - 3.0.9-SNAPSHOT + 3.0.10-SNAPSHOT 2.2.4 Hoxton.RELEASE 2.1.1 @@ -65,7 +65,7 @@ sonatype-oss-release - 3.0.9 + 3.0.10 diff --git a/Milkomeda/src/main/java/com/github/yizzuide/milkomeda/ice/DelayJobHandler.java b/Milkomeda/src/main/java/com/github/yizzuide/milkomeda/ice/DelayJobHandler.java index 195d2fd4..6f0fe81e 100644 --- a/Milkomeda/src/main/java/com/github/yizzuide/milkomeda/ice/DelayJobHandler.java +++ b/Milkomeda/src/main/java/com/github/yizzuide/milkomeda/ice/DelayJobHandler.java @@ -3,6 +3,7 @@ import com.github.yizzuide.milkomeda.universe.metadata.HandlerMetaData; import com.github.yizzuide.milkomeda.universe.polyfill.RedisPolyfill; import com.github.yizzuide.milkomeda.util.RedisUtil; +import com.github.yizzuide.milkomeda.util.ReflectUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationListener; @@ -10,6 +11,7 @@ import org.springframework.util.CollectionUtils; import java.lang.reflect.Method; +import java.util.Collections; import java.util.List; /** @@ -17,7 +19,7 @@ * * @author yizzuide * @since 1.15.0 - * @version 3.0.8 + * @version 3.0.10 * Create at 2019/11/16 17:30 */ @Slf4j @@ -123,6 +125,7 @@ public void run() { /** * 处理ttr的任务 */ + @SuppressWarnings("unchecked") private void processTtrJob(DelayJob delayJob, Job job) { log.warn("Ice处理TTR的Job {},当前重试次数为{}", delayJob.getJodId(), delayJob.getRetryCount() + 1); // 检测重试次数过载 @@ -137,7 +140,7 @@ private void processTtrJob(DelayJob delayJob, Job job) { handlerMetaDataList.forEach(handlerMetaData -> { Method method = handlerMetaData.getMethod(); try { - method.invoke(handlerMetaData.getTarget(), job); + ReflectUtil.invokeWithWrapperInject(handlerMetaData.getTarget(), method, Collections.singletonList(job), Job.class, Job::getBody, Job::setBody); } catch (Exception e) { log.error("Ice invoke TTR overload listener error: {}", e.getMessage(), e); } diff --git a/MilkomedaDemo/pom.xml b/MilkomedaDemo/pom.xml index 7393c96b..68cc0077 100644 --- a/MilkomedaDemo/pom.xml +++ b/MilkomedaDemo/pom.xml @@ -20,7 +20,7 @@ UTF-8 1.8 Hoxton.RELEASE - 3.0.9-SNAPSHOT + 3.0.10-SNAPSHOT 2.1.1 diff --git a/MilkomedaDemo/src/main/java/com/github/yizzuide/milkomeda/demo/ice/handler/ProductCheckHandler.java b/MilkomedaDemo/src/main/java/com/github/yizzuide/milkomeda/demo/ice/handler/ProductCheckHandler.java index 5b60db97..387c874b 100644 --- a/MilkomedaDemo/src/main/java/com/github/yizzuide/milkomeda/demo/ice/handler/ProductCheckHandler.java +++ b/MilkomedaDemo/src/main/java/com/github/yizzuide/milkomeda/demo/ice/handler/ProductCheckHandler.java @@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j; import java.time.Duration; -import java.util.Map; /** * ProductCheckHandler @@ -22,9 +21,9 @@ public class ProductCheckHandler { // 监听topic消息(支持SpEL) @IceListener(topic = "#target.topicName()") public Job handle(Job productJob) { - log.info("接收到Job: {}", productJob); - // 测试处理失败 -// int i = 1 / 0; + log.info("接收到Job: {}", productJob); + // 测试处理失败 +// int i = 1 / 0; // 重新入队到新topic Product product = productJob.getBody(); product.setDesc("再次审核"); @@ -43,7 +42,7 @@ public String topicName() { } @IceTtrOverloadListener(topic = "#target.topicName()") - public void ttrHandle(Job> job) { + public void ttrHandle(Product job) { log.error("trr overload with job: {}", job); } }