java - HystrixCommand annotation - how to do fallback with throw -


i using @hystrixcommand create fallbacks in java server.

here 1 method have issue im having im wondering allowed throw in fall ?

@hystrixcommand(fallbackmethod = "dofallback", commandkey = "dofallbackcommand")    public response getgraphpoints(string id, string position) {  //do work ... create response         return a_response;     }     public response dofallback(string id, string position) {      //can in hystrix command ? or have return response here?no other method catch throw        throw new serviceunavailableexception("points not found");    } 

the reason im asking when run im getting following error:

error [hystrixtimer-1] [com.netflix.hystrix.contrib.javanica.command.genericcommand] [myserver] failed processed fallback method: 'dofallback'.  

i had same problem, understand little how hystrix "think". hystrix not require set 1 fallback method. unless want return default data or add business logic case, not necessary. if throw exception you'll "confuse" hystrix, throw hystrixruntimeexception.

i hope helps.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -