How to dynamically inject hystrix properties?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to dynamically inject hystrix properties?

Priyanka Gopinath
I have this special usecase where I want to change the threadpool size and
thread pool key based upon the endpoint that is getting called. All of
these values are available in the configuration on the exchange.

For eg :

Endpoint A => Threadpool(5) => Threadpool key(A)
Endpoint B => Threadpool(10) => Threadpool key(Z)
Endpoint C => Threadpool(5) => Threadpool Key(A)

However, in my hystrix route, all of the params for Hystrix EIP are strings
and I aven't been able to figure the a way to evaluate the same.

from("direct:something")
.hystrix()
.threadPoolkey(hystrix.???? How to inject this value)
.end()
.to("direct:http-endpoint");

I also tried creating a HystrixThreadpoolDefinition and tried setting it
as .hystrix().hystrixConfiguration(configuration). But it comes back to the
same question of how to pass in this configuration. Method calls return
ValueBuilders and I could not cast them to the strings/configDefinitions.

Please suggest the correct way of doing it.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to dynamically inject hystrix properties?

Claus Ibsen-2
Maybe create 3 different routes where each hystrix is using A, B or C
keys and then call the appropiate route.

On Mon, Apr 17, 2017 at 12:46 AM, Priyanka Gopinath <[hidden email]> wrote:

> I have this special usecase where I want to change the threadpool size and
> thread pool key based upon the endpoint that is getting called. All of
> these values are available in the configuration on the exchange.
>
> For eg :
>
> Endpoint A => Threadpool(5) => Threadpool key(A)
> Endpoint B => Threadpool(10) => Threadpool key(Z)
> Endpoint C => Threadpool(5) => Threadpool Key(A)
>
> However, in my hystrix route, all of the params for Hystrix EIP are strings
> and I aven't been able to figure the a way to evaluate the same.
>
> from("direct:something")
> .hystrix()
> .threadPoolkey(hystrix.???? How to inject this value)
> .end()
> .to("direct:http-endpoint");
>
> I also tried creating a HystrixThreadpoolDefinition and tried setting it
> as .hystrix().hystrixConfiguration(configuration). But it comes back to the
> same question of how to pass in this configuration. Method calls return
> ValueBuilders and I could not cast them to the strings/configDefinitions.
>
> Please suggest the correct way of doing it.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to dynamically inject hystrix properties?

Priyanka Gopinath
Thank you for the response. I was able to inject values dynamically after
creating a new hystrix route per endpoint.

On Tue, Apr 18, 2017 at 3:44 AM, Claus Ibsen <[hidden email]> wrote:

> Maybe create 3 different routes where each hystrix is using A, B or C
> keys and then call the appropiate route.
>
> On Mon, Apr 17, 2017 at 12:46 AM, Priyanka Gopinath <[hidden email]>
> wrote:
> > I have this special usecase where I want to change the threadpool size
> and
> > thread pool key based upon the endpoint that is getting called. All of
> > these values are available in the configuration on the exchange.
> >
> > For eg :
> >
> > Endpoint A => Threadpool(5) => Threadpool key(A)
> > Endpoint B => Threadpool(10) => Threadpool key(Z)
> > Endpoint C => Threadpool(5) => Threadpool Key(A)
> >
> > However, in my hystrix route, all of the params for Hystrix EIP are
> strings
> > and I aven't been able to figure the a way to evaluate the same.
> >
> > from("direct:something")
> > .hystrix()
> > .threadPoolkey(hystrix.???? How to inject this value)
> > .end()
> > .to("direct:http-endpoint");
> >
> > I also tried creating a HystrixThreadpoolDefinition and tried setting it
> > as .hystrix().hystrixConfiguration(configuration). But it comes back to
> the
> > same question of how to pass in this configuration. Method calls return
> > ValueBuilders and I could not cast them to the strings/configDefinitions.
> >
> > Please suggest the correct way of doing it.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Loading...