如果出现任何错误,我必须为列表中的每个项目调用falback并继续处理其他项目,是否可能?
@Subscriber('dupe-user-check')
@HystrixCommand(fallbackMethod = "subscriptionSearchFallback")
void duplicateUserCheck(Object payload) {
// call to other microservice
//Validate response and see if user already exist for this item
//If yes
throw new DuplicateUserException("User Already Exist. Response Payload
${response.json.toString()}")
.........................................................
}
void subscriptionSearchFallback(Object payload, Throwable throwable) {
logger.error("SUBSCRIPTION SEARCH FALLBACK :", throwable)
itemStatusUpdateService.updateItemStatus(item.itemKey,DUPE_EMAIL_FAILED)
}
目前它不会后退。
异常追踪:
java.lang.IllegalArgumentException异常: ValidationDuplicateEmailService :: User已经存在。响应有效负载 {" statusDesc":[" 999 - 用户信息不是 有效"]," hasErrors":true," statusCode":" 999"} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 在 org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1076) 在 org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) 在 org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77) 在 org.codehaus.groovy.runtime.callsite.ConstructorSite $ ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84) 在 org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247) 在 com.xyz.ValidationDuplicateEmailService.duplicateUserCheck(ValidationDuplicateEmailService.groovy:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498)at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427) 在 org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:216) 在 grails.events.subscriber.MethodSubscriber.call(MethodSubscriber.groovy:51) 在 org.grails.events.EventSubscriberTrigger.proceed(EventSubscriberTrigger.groovy:31) 在 org.grails.events.bus.ExecutorEventBus $ _buildNotificationCallable_closure1 $ _closure3.doCall(ExecutorEventBus.groovy:36) 在 org.grails.events.bus.ExecutorEventBus $ _buildNotificationCallable_closure1 $ _closure3.call(ExecutorEventBus.groovy) 在groovy.lang.Closure.run(Closure.java:495)at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) 在java.util.concurrent.FutureTask.run(FutureTask.java:266)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 在 java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745)