I am using hystrix for implementing circuit breaker concept in my springboot service. The HystrixCommand annotation that I use on the method that needs to be throttle the external service calls in case of threshhold number of failures is as follows:
@HystrixCommand(commandKey = "myCommandKey",
groupKey = "myGroupKey",
threadPoolKey = "myThreadPoolKey")
public String myHystrixMethod(String someParam) { ....}
Now, the service where myHystrixMethod resides is called by different clients. Based on the type of client that invokes the service, there is a logic to call a backend service designated for that particular client.
What I would like to do is to register all the threads (requests) invoked by a specific client in it's own hystrix threadpool. Which means, requests from client A would get registered in hystrix threadpool for client A and for client B in a hystrix threadpool for client B only. This would ensure that client B's requests to my service aren't throttled due to failures in client A.
For this, I can create separate service methods (one shown above) for every client and name the hystrix thread pool accordingly. However, with this approach, whenever there is a new client, i'll have to modify the source code to add it's service method.
Is there a way I can dynamically create the options inside of @HystrixCommand annotation based on a parameter, which is client ID in this case ?