Hi On Wed, Jul 28, 2010 at 8:00 PM, Nelson, Chris <[email protected]>wrote:
> I'm getting close to a solution that works for at least my needs. Basically > I modified the WebClient handleResponse method to look pretty much like the > ClientImpl processResult method. Like ClientImpl a retry method is invoked > on the WebClient by the conduit selector if there is an error that requires > failover. The part I'm struggling with is building the failover URL from the > base URL and the current URL. For example, if I have the following failover > URLs configured for failover... > > http://server1:8080/context1 > http://server1:9090/context2 > > If I send a client request to http://server1:8080/context1/a/b/c and there > is an IOException I want to fail this over to > http://server:9090/context2/a/b/c. So far I haven't found a good way to > figure out /a/b/c is what I want to prepend to the failover base URL. > > I think I need a few beers and it will all become clear. > > What is the base failover URI ? If it were common between multiple URIs then you'd be able to do webClient.back(fast).path(newRelativeOne) ? Perhaps templating the failover URI and using UriBuilder to replace the variable parts may also help. But why you can't just replace the whole current URI with the new one ? cheers, Sergey > Chris > > -----Original Message----- > From: Jim Talbut [mailto:[email protected]] > Sent: Wednesday, July 28, 2010 12:57 AM > To: [email protected] > Subject: Re: WebClient Failover > > On 27/07/2010 20:09, Daniel Kulp wrote: > > On Tuesday 27 July 2010 10:58:52 am Nelson, Chris wrote: > > > >> Is there a good way to implement failover in the WebClient? I have > >> tried setting a FailoverTargetSelector on the client configuration, > >> but that causes all kinds of problems. I've started creating a custom > >> WebClient along with a new failover conduit selector, but I'm hoping > >> there is an easier way. > >> > > Much of the failover stuff in CXF was designed more for the WSDL based > things > > and is designed to failover from port to port from the wsdl service. > That > > obviously isn't ideal for the REST stuff. A simple > > FailoverTargetSelector that operates with just a list of URL's would > > be a great start, but not something I've had time to really look at. > > > > Would you consider submitting some patches to enhance the failover > > stuff in CXF to better support your use case? > > > This is just a me too, so I'd be very interested in seeing a solution for > this. > > If you don't have time to do it yourself, Chris, maybe we could work > together on it? > > Jim > >
