Hysterix fallback not running and gives connection refused

36 Views Asked by At

I have a book service calling author service. Book service calls author service, with a fallback. I stopped author service to check if hysterix calls fallback, but it didn't get called and I get an error:

java.lang.IllegalStateException: No instances available for AUTHOR

Why am I getting this - any idea on this?

Full code: https://github.com/prerak13/SpringMegaApp

@HystrixCommand(fallbackMethod = "authorFallback")
public List<BookWithAuthorPojo> bookWithAuthor() throws Exception{

    return br.getAllBooks()
            .stream().map(book -> {
                        String response = restTemplate.getForObject("http://AUTHOR/author/" + book.aid, String.class);
                        JSONObject jsonObj = new JSONObject(response);
                        String authorName = jsonObj.getString("name");
                        return new BookWithAuthorPojo(book.name, authorName);
                    }
            ).toList();
}
0

There are 0 best solutions below