You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by LTay <le...@gmail.com> on 2010/02/26 11:59:25 UTC

Setting up ClientProxies to use for Failover

Hi all,

Finally managed to figure out how to get failover working for my client. The
problem I'm running into now is that when the client does failover to an
alternate address, it uses the address that is in the wsdl.

But I'd rather not hardcode the actual addresses in the wsdl (would rather
get it from a database config table) and set the endpoint address either at
deployment/runtime. Also I need to configure a few things such as read and
connection timeouts and disable host name checking on the client by doing
this:

Client client = ClientProxy.getClient(proxy);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
TLSClientParameters tlsClientParameters = new TLSClientParameters();
tlsClientParameters.setDisableCNCheck(disableHostNameCheck);
conduit.setTlsClientParameters(tlsClientParameters);

I can do this for the very 1st port used, since I can set up the client
proxy before passing it on to be used. But not for the succeeding ports when
failing over.

Has anyone come across this and been able to maybe inject a client proxy
into the FailoverTargetSelector perhaps?

Thanks,
Lesley
-- 
View this message in context: http://old.nabble.com/Setting-up-ClientProxies-to-use-for-Failover-tp27716894p27716894.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Setting up ClientProxies to use for Failover

Posted by Eoghan Glynn <eo...@gmail.com>.
Hi Lelsey,

> Seems you can specify alternate addresses in the config.xml - but that
would
> still mean that you are hardcoding the addresses in the config file.

Yes, the idea was to allow the *same* level of flexibility around overriding
via the config file, as one would have for a non-replicated endpoint (in
which case the address specified in the WSDL can be overridden via the
"address" attribute of the <jaxws:client> bean in config).

So in the replicated case the alternateAddresses property is intended to be
an analogue for the way this /jaxws:client/@address attribute is used in the
non-replicated case.


> The test for say testOverriddenSequentialStrategy seems to set
> up a ControlService class to run on the address REPLICA_C. Then
> it sets up the greeter to use
> {http://cxf.apache.org/greeter_control}ReplicatedPortA but then
> when the client invokes the service, the endpoint used is
> actually REPLICA_C?

Yeah, so the idea of the test is to trigger a failover event by ensuring
from the get-go that there's nothing listening on the REPLICA_A port. So the
client will try to bind to that address first, and then failover as
appropriate until a live address is found (in this case for REPLICA_C).


> Is there also a way to override other parameters on the client e.g.
> connection/read timeout and SSL parameters like disabling hostname
checking?

Well for the failover aspect, only the address can be overridden.

But I don't see why the usual approach to configuring the HTTPS parameters
shouldn't work in this case, because there's no coupling between the
overridden address(es) and the <http:conduit> beans used to specify the TLS
config. So I think it should be fine to just specify a <http:conduit> bean
for each logical port and then override the physical addresses as described
before.

Cheers,
Eoghan


On 26 February 2010 23:03, LTay <le...@gmail.com> wrote:

>
> Hi Eoghan,
>
> Thanks for that, I've been looking at the test and the config file below.
> I'm not sure if I understand it correctly.
>
> Seems you can specify alternate addresses in the config.xml - but that
> would
> still mean that you are hardcoding the addresses in the config file.
>
> Maybe you can confirm for me if I understand it correctly. The test for say
> testOverriddenSequentialStrategy seems to set up a ControlService class to
> run on the address REPLICA_C. Then it sets up the greeter to use
> {http://cxf.apache.org/greeter_control}ReplicatedPortA but then when the
> client invokes the service, the endpoint used is actually REPLICA_C?
>
> Is there also a way to override other parameters on the client e.g.
> connection/read timeout and SSL parameters like disabling hostname
> checking?
>
> Thanks,
> Lesley
>
>
> Eoghan Glynn-4 wrote:
> >
> > Hi Lesley,
> >
> > The alternate addresses in the WSDLs are indeed used by default, but you
> > can
> > override this by specifying an alternate address list in the config.
> >
> > See the FailoverAddressOverrideTest[1] and particularly the associated
> > config[2] for details.
> >
> > Cheers,
> > Eoghan
> >
> > [1]
> >
> http://svn.apache.org/repos/asf/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverAddressOverrideTest.java
> > [2]
> >
> http://svn.apache.org/repos/asf/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover_address_override.xml
> >
> >
> --
> View this message in context:
> http://old.nabble.com/Setting-up-ClientProxies-to-use-for-Failover-tp27716894p27724457.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Setting up ClientProxies to use for Failover

Posted by LTay <le...@gmail.com>.
Hi Eoghan,

Thanks for that, I've been looking at the test and the config file below.
I'm not sure if I understand it correctly.

Seems you can specify alternate addresses in the config.xml - but that would
still mean that you are hardcoding the addresses in the config file.

Maybe you can confirm for me if I understand it correctly. The test for say
testOverriddenSequentialStrategy seems to set up a ControlService class to
run on the address REPLICA_C. Then it sets up the greeter to use
{http://cxf.apache.org/greeter_control}ReplicatedPortA but then when the
client invokes the service, the endpoint used is actually REPLICA_C?

Is there also a way to override other parameters on the client e.g.
connection/read timeout and SSL parameters like disabling hostname checking? 

Thanks,
Lesley


Eoghan Glynn-4 wrote:
> 
> Hi Lesley,
> 
> The alternate addresses in the WSDLs are indeed used by default, but you
> can
> override this by specifying an alternate address list in the config.
> 
> See the FailoverAddressOverrideTest[1] and particularly the associated
> config[2] for details.
> 
> Cheers,
> Eoghan
> 
> [1]
> http://svn.apache.org/repos/asf/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverAddressOverrideTest.java
> [2]
> http://svn.apache.org/repos/asf/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover_address_override.xml
> 
> 
-- 
View this message in context: http://old.nabble.com/Setting-up-ClientProxies-to-use-for-Failover-tp27716894p27724457.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Setting up ClientProxies to use for Failover

Posted by Eoghan Glynn <eo...@gmail.com>.
Hi Lesley,

The alternate addresses in the WSDLs are indeed used by default, but you can
override this by specifying an alternate address list in the config.

See the FailoverAddressOverrideTest[1] and particularly the associated
config[2] for details.

Cheers,
Eoghan

[1]
http://svn.apache.org/repos/asf/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverAddressOverrideTest.java
[2]
http://svn.apache.org/repos/asf/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover_address_override.xml

On 26 February 2010 10:59, LTay <le...@gmail.com> wrote:

>
> Hi all,
>
> Finally managed to figure out how to get failover working for my client.
> The
> problem I'm running into now is that when the client does failover to an
> alternate address, it uses the address that is in the wsdl.
>
> But I'd rather not hardcode the actual addresses in the wsdl (would rather
> get it from a database config table) and set the endpoint address either at
> deployment/runtime. Also I need to configure a few things such as read and
> connection timeouts and disable host name checking on the client by doing
> this:
>
> Client client = ClientProxy.getClient(proxy);
> HTTPConduit conduit = (HTTPConduit) client.getConduit();
> TLSClientParameters tlsClientParameters = new TLSClientParameters();
> tlsClientParameters.setDisableCNCheck(disableHostNameCheck);
> conduit.setTlsClientParameters(tlsClientParameters);
>
> I can do this for the very 1st port used, since I can set up the client
> proxy before passing it on to be used. But not for the succeeding ports
> when
> failing over.
>
> Has anyone come across this and been able to maybe inject a client proxy
> into the FailoverTargetSelector perhaps?
>
> Thanks,
> Lesley
> --
> View this message in context:
> http://old.nabble.com/Setting-up-ClientProxies-to-use-for-Failover-tp27716894p27716894.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>