You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Yevgeny F <fa...@yahoo.com> on 2013/11/18 10:56:47 UTC

Reuse jax-ws client proxies for different addresses

I have a bunch of web services servers (around 200) running on the same
machine which expose the same service on different ports. I have a client
which perform tasks which include calling the service on different servers.
Something like:

while (true) {
    task = readTask();
    runHelloService(task.serverAddress)
}

I was wondering what is the best way to generate the HelloService client
proxy.
Can I generate one and replace the target address before each call?
Should i generate a client per server (which means 200 client proxies) and
use the relevant one?
I will probably want to run the above loop concurrently on several threads.
Currently I have only one proxy which is generated by spring and cxf with
the jaxws:client declaration.




--
View this message in context: http://cxf.547215.n5.nabble.com/Reuse-jax-ws-client-proxies-for-different-addresses-tp5736463.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Reuse jax-ws client proxies for different addresses

Posted by Daniel Kulp <dk...@apache.org>.
On Nov 18, 2013, at 4:56 AM, Yevgeny F <fa...@yahoo.com> wrote:

> I have a bunch of web services servers (around 200) running on the same
> machine which expose the same service on different ports. I have a client
> which perform tasks which include calling the service on different servers.
> Something like:
> 
> while (true) {
>    task = readTask();
>    runHelloService(task.serverAddress)
> }
> 
> I was wondering what is the best way to generate the HelloService client
> proxy.
> Can I generate one and replace the target address before each call?

This may be OK as long as you override the address via the request context and don’t dig into the conduit/endpoint to change the address.   Also, don’t reset anything auth specific or anything like that.     The proxy is thread safe, but the underlying conduit does store some state (such as cookies) and such.

> Should i generate a client per server (which means 200 client proxies) and
> use the relevant one?
> I will probably want to run the above loop concurrently on several threads.
> Currently I have only one proxy which is generated by spring and cxf with
> the jaxws:client declaration.

You may want to consider either a pool of proxies or a proxy per thread (if low number of threads).

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com