smallrye / smallrye-stork

SmallRye Stork is a service discovery and client side-load balancing framework.

Home Page:http://smallrye.io/smallrye-stork/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loadbalacing using the request scoped information

ivansenic opened this issue · comments

I am trying to understand if there is any option to implement the custom load balancing that would depend on the request scoped bean when Stork is integrated into Quarkus.

For example, there is a nice explanation in the documentation about service labels and how can you decide to send some portion of traffic to V1 and some to V2. However, let's imaging that I have a header value with my incoming request with the value of the depending service to use. Is there any way to access the request scoped information when I decide what service to load balance to?

Is there any way I can configure Stork with Quarkus using the CDI and inject arbitrary beans? If this would be possible, then I guess this would work. Or for example, can I access the ArC beans in some kind of a static way from that custom load balancing config?

I don't really know anything about Stork, but you can always access the CDI container in Quarkus using CDI.current() or Arc.container().

This is an interesting question, @aureamunoz can you provide some insight?

Hi, yes! This PR introduced a Stork Filter for URIs starting with stork://or storks://so with the methods mentioned by @Ladicek you should be able to access the request