Hystrix command does not work in a Hystrix environment

I have a problem with my Hystrix commands. If the hystrix wrapped method is called from a class, the hystrix-wrapped method does not start in the Hystrix environment

In this case, I see the logs as

05-02-2018 22:51:25.809 [http-nio-auto-1-exec-3] INFO  c.i.q.v.e.ConnectorImpl.populateFIDSchema -
    populating FID Schema

But if I call the same method from outside the class, I see that it runs it in the Hystrix environment

 05-02-2018 22:54:53.735 [hystrix-ConnectorImpl-1] INFO  c.i.q.v.e.ConnectorImpl.populateFIDSchema -
    populating FID Schema

I wrap my method using HystrixCommand as follows

 @HystrixCommand(commandKey = "getSchemaCommand", fallbackMethod = "getSchemaCommandFallback")

Any ideas?

+4
source share
2 answers

This is a limitation of Spring AOP (Hystrix-Javanica is based on AOP).
When you call a method locally, it does not go through the proxy server and, therefore, it really does not work in the Hystrix environment, instead it works as if it were another method.

, - , , .

. @Cacheable

Hystrix (Spring AOP) . , .

+2

@pvpkiran, AspectJ, Spring . Spring AOP - , AspectJ -, - - , , , -.

. Spring AOP AOP Proxies Spring .

AspectJ, , - , - - Spring AOP.

AspectJ AOP, Spring AOP AspectJ ( Spring Spring AspectJ ).

+1

Source: https://habr.com/ru/post/1693204/


All Articles