I would like to forward a request header with a feign client RequestInterceptor but, within RequestInterceptor.apply
, RequestContextHolder.getRequestAttributes()
is null
, so is SecurityContextHolder.getContext().getAuthentication()
(where I could also eventually get the value of my header).
This used to work before upgrading to Spring-Cloud Brixton, where the hystrix commands must now probably be run in a separate thread, because changing to the following parameter solves the problem :
hystrix.command.default.execution.isolation.strategy: SEMAPHORE
Now, I'm not too keen on changing this kind of default values if not necessary, is there another, recommended, way of forwarding headers now ?
Thanks
@RequestHeader
to a feign method. You could also individually set each feign call to SEMAPHORE withhystrix.command.<methodname>.execution.isolation.strategy: SEMAPHORE
.THREAD
isolation strategy (github.com/Netflix/Hystrix/wiki/…). In my case I think changing the isolation level to make the developement experience easier is not a good idea ... we will go with the@RequestHeader
solution. Thanks a bunch anyways for the great work with spring cloud :-)