Hi, Sorry, I missed your previous message.
The main difference between Karaf proxy feature and Cellar one is that Karaf is static (you have to define your endpoint explicitly) whereas Cellar is dynamic (updated automatically when a new node join the cluster). I plan to add new balancing algorithms and feature in Karaf proxy feature (some coming from Vineyard API gateway ideas ;) ). Regarding Cellar, I started a deep/large refactoring (it needs some time still). Regards JB > Le 26 juin 2020 à 09:21, Jean-Baptiste Simillon > <[email protected]> a écrit : > > Answering to myself > > To add multiple destinations to a proxy I just had to separate URLs with a > comma, easy enough :) > proxy-add --lb random /test > http://10.0.200.15:8181/booking,http://10.0.35.203:8181/booking > <http://10.0.200.15:8181/booking,http://10.0.35.203:8181/booking> > > I really like this solution, we could manage a list of available endpoints > ourselves (maybe based on cellar cluster:service-list since our services will > also be available as DOSGi services) and update proxy accordingly > > Thanks for the suggestion ! > Regards, > JB > > > Le mer. 24 juin 2020 à 09:14, Jean-Baptiste Simillon > <[email protected] > <mailto:[email protected]>> a écrit : > Hi JB, > > I didn't know about the proxy feature, but my idea was for the final > (micro-services) architecture to have one (or more) karaf instance that > relays REST requests to karaf instances that have the REST entry point > declared. > > For example : > Karaf instance A > Bundle foo declares service on /foo > Bundle bar declares service on /bar > Karaf instance B > Bundle bar declares service on /bar > Karaf instance C > Bundle foo declares service on /foo > Ideally what I wanted is that my REST client could call any instance A,B or C > and then the call would be relayed to any instance that provides a service on > the entry point. > For example : > if I call http://C/foo <http://c/foo> it could be relayed to C/foo or A/foo > if I call http://C/bar <http://c/bar> it would be relayed to A or B since > /bar it's not available locally > Maybe I would need other karaf instances, let's say an instance D that will > not declare any service locally but would just relay calls, that could also > work for me. > > Do you think such a thing would be possible with cellar (if tweaking cxf is > possible of course) ? > > Or maybe the proxy solution could be interesting if I can automate proxy > declaration (for example using cellar I could send registration messages on > hazelcast, or maybe use dosgi or any another solution). > But I didn't find a way to add two destinations for a single source, I tried > to call proxy-add twice with the -lb option or adding two urls at once but > none of these options seems to work. > Is it possible to add multiple load-balanced destinations for a single entry > point with the proxy feature ? (so that a call to C/proxied-foo could > redirect to C/foo or A/foo) > > Regards, > JB > > > > Le mar. 23 juin 2020 à 17:25, Jean-Baptiste Onofre <[email protected] > <mailto:[email protected]>> a écrit : > Hi, > > FYI, you have the proxy feature in Karaf directly (without Cellar). > > Rest is using CXF servlet. The CXF servlet should be registered with the flag > to be taken by Cellar whiteboard (provided by Aries JAXRS whiteboard). > Let me check if it’s possible to tweak the CXF servlet registration made by > Aries JAXRS Whiteboard. > > Regards > JB > >> Le 23 juin 2020 à 17:10, Jean-Baptiste Simillon >> <[email protected] >> <mailto:[email protected]>> a écrit : >> >> Hi, >> >> I've been trying for hours to make my REST service (that was made thanks to >> whiteboard) available on cellar http balancer but can't figure out what is >> not working. >> So as a last resort I tried to make the karaf-rest-example-whiteboard work, >> and to my surprise it didn't work either over http balancer. >> >> So basically what I do is install 2 karaf with cellar on 2 computers >> feature:repo-add cellar >> feature:install cellar >> feature:install http >> feature:install http-whiteboard >> feature:install cellar-http-balancer >> >> Then I add the example on one node >> feature:repo-add >> mvn:org.apache.karaf.examples/karaf-rest-example-features/LATEST/xml >> feature:install karaf-rest-example-whiteboard >> >> My nodes see each others >> karaf@root()> cluster:node-list >> │ Id │ Alias │ Host Name │ Port >> ──┼──────────────────┼───────┼─────────────┼───── >> x │ 10.0.35.203:5701 <http://10.0.35.203:5701/> │ │ 10.0.35.203 │ 5701 >> │ 10.0.200.15:5701 <http://10.0.200.15:5701/> │ │ 10.0.200.15 │ 5701 >> >> But no services are available on the cluster : >> karaf@root()> cluster:http-list default >> >> Alias │ Locations >> ──────┼────────── >> karaf@root()> >> >> And when I try to connect through curl it works only from the node where the >> example is installed. >> It seems to work fine when I try to use the blueprint example, but I find >> the whiteboard example way easier to maintain (no xml files needed, just >> standard annotations). Do you have any idea what could be missing to make >> the whiteboard example working on cellar http balancer ? >> >> Regards >> >> >> >
