Your english is perfect and thanks for taking time to reply late in the night :)
So, couple of questions really:
- Would you expect to see the traffic balanced across both prov1 and prov2 in this scenario
- Should the current dosgi implementation handle fail over, i.e. If prov1 goes away prov2 steps in to service the calls
Thanks for that Guillaume, that explains where I got to.I ended up writing a consumer, in the root container, that used a blueprint reference list to get the DOSGI proxies. I then randomly selected a reference out of the list to do the actual work. This gave me load balancing and the ability to dynamic add and remove services. It also explains why I was seeing, under heavy load, calls blocking when I removed a service. I'm guessing these were cases where the client was getting a reference to the ephemeral node, that was no longer backed. In this circumstance, is there any surefire check, other than trying to make a method call, to assess the validity of the reference?
The reason I was playing with this stuff is that I wanted to be able to load balance across a dynamic set of JAX-RS CXF endpoints. I did try the org.fusesource.fabric.cxf.FabricLoadBalancerFeature approach, but this didn't want to play ball with a JAX-RS client, only JAX-WS. The solution I landed on, ended up being a bit convoluted.
- Write a JAX-RS service that implements IMyService, expose two instance in prov1 and prov2 over DOSGI
- Write another implementation of IMyService, but this implementation takes a reference list of implementations of IMyService, as above, and is exposed to the big wide world over HTTP
- I then chose a random reference, within the exposed IMyService implementation and use a JAX-RS proxy client to drive the service proper and return it's response
- If I need HA for the root container, I can create a duplicate and use camel to load balance + fail over across the two exposed HTTP endpoints
Whilst this gives me the ability to spin up new service providers and automatically use them, load balance across them, and remove them if required, this seems like a complicated solution. I'm introducing an additional two layers, containers and new bundles, just to achieve this. Is there a better solution to what I'm trying to achieve?Apologies for the rather wordy reply, I'm just keen to get this optimal solution early on in our project.