hystrix Fallback 没有被集合中的单个项目调用

hystrix Fallback is not getting called for invidiual Item in Collection

如果出现任何错误,我必须为列表中的每个项目调用 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 Already Exist. Response Payload {"statusDesc":["999 - User information is not valid"],"hasErrors":true,"statusCode":"999"} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1076) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247) at com.xyz.ValidationDuplicateEmailService.duplicateUserCheck(ValidationDuplicateEmailService.groovy:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427) at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:216) at grails.events.subscriber.MethodSubscriber.call(MethodSubscriber.groovy:51) at org.grails.events.EventSubscriberTrigger.proceed(EventSubscriberTrigger.groovy:31) at org.grails.events.bus.ExecutorEventBus$_buildNotificationCallable_closure1$_closure3.doCall(ExecutorEventBus.groovy:36) at org.grails.events.bus.ExecutorEventBus$_buildNotificationCallable_closure1$_closure3.call(ExecutorEventBus.groovy) at groovy.lang.Closure.run(Closure.java:495) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

这不起作用的原因是因为使用@HystrixCommand 的方法是从同一个 class 中调用的。

问题的答案中所述,这是 Spring 的 AOP 的限制。