1 of 1 people found this helpful
You need to create an instance of InfinispanRegistry for use with ClusteredInvoker:
Thank you for your answer. I've been trying to create an instance of InfinispanRegistry but so far couldn't do so, as the InfinispanRegistry constructor requires Infinispan's Cache instance but I'm not sure how to get the instance.
If I understand your intent correctly, in order to get a Cache instance we need to first launch DefaultCacheManager locally in the standalone application and let it join the Infinispan clustering group for the SwitchYard servers so that the same copy of cache SwitchYard servers have is loaded and accessible locally. Is that approach what you meant?
I haven't succeeded in this approach so far; The launched DefaultCacheManager somehow doesn't join the SwitchYard's cluster group. Maybe my JGroups configuration is wrong but I don't know where the problem is.
I've attached my project (cluster.zip), so could you please have a look at it and if possible show me the correct configuration?
cluster.zip 12.6 KB
I finally reached the conclusion that the current ClusteredInvoker API does in fact not allow us to use it outside of a SwitchYard server, or if it's possible at all, it's pretty hard or limited.
Firstly, it looks quite difficult to make a standalone Java client join the Infinispan cluster group for SwitchYard servers, and even if it's possible, it shouldn't be a good design that short-lived, temporary standalone Java clients join and leave the cluster group so frequently. There is also a critical limitation that all the members of the Infinispan cluster group must be in the same subnet mask, so this approach is only appricable to the clients in the same subnet mask.
Considering all these, I think it's impractical to use ClusteredInvoker outside of a SwitchYard server. Just in case, I'll file a RFE to deal with this limitation later on.
For now, the preferred approach to invoke a SY service in a load-balanced manner seems to be using HttpInvoker with an external load-balancer such as mod_jk or mod_cluster. Please let me know if there are any pitfalls in this alternative approach. Thanks.