0

I am testing a feign client slow response using chaos monkey spring boot. Fallback is getting called and response is returned back but the method execution continues.

logger.info("Get the value from the organization ms {}",Thread.currentThread().getName());
organizationDTO = organizationRemoteData.getRemoteOrgData(organizationId); // 1
logger.info("saving data in cache {} by {}", organizationDTO,Thread.currentThread().getName());
// saving data in redis
cacheOrganizationObject(organizationDTO);
return organizationDTO;

Line number 1 is failing and fallback get called but I still see the "saving data in cache" in logs. This behavior makes the application inconsistent. is there any workaround?

Logs:

Get the value from the organization ms hystrix-organizationThreadPool-1
calling fallback method to get the organization data for id 1
saving data in cache OrganizationDTO [] by hystrix-organizationThreadPool-1
Joker
  • 2,304
  • 25
  • 36
Chandresh Mishra
  • 1,081
  • 3
  • 24
  • 45
  • Is your question why the "saving data in cache" is written in logs? Fallback Method returns something and the logging is the next line, so thats completly normal. Or where you think is the inconsistency? – Joker Oct 17 '19 at 15:04
  • line number one fires the fallback and fallback returns. So saving data in cache should not be printed. Moreover "saving data in cache" prints the OrganizationDTO is is returned from the API not from the fallback – Chandresh Mishra Oct 17 '19 at 15:11

0 Answers0