You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Bernard Maassen <bm...@een.com> on 2019/12/17 08:29:04 UTC

Using same client for multiple endpoints

I was wondering if it's possible to reuse the same client/proxy for
multiple endpoints.
My situation:
* i generated the client java code from the wsdl
* client is created using JaxWsProxyFactoryBean.create( service.class )
* this is repeated a few thousand times, for different ip/port user/pass

The issue:
each proxy takes about 2mb of memory, which if it's just one client is
not really an issue, but when having a few thousand it adds up. And as
the only thing that is really different between them is the ip/port
and user/password used, i have the feeling it could/should be done
differently.

Any thoughts?

Bernard

Re: Using same client for multiple endpoints

Posted by bmaassen <bm...@een.com>.
Hi Colm,

Thank you for the pointer, 
after setting
((BindingProvider)proxy).getRequestContext().put("thread.local.request.context",
"true");
i can now indeed configure a per client config in the local RequestContext,
and use the same client to connect to all endpoints.

Bernard 



--
Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html

Re: Using same client for multiple endpoints

Posted by Colm O hEigeartaigh <co...@apache.org>.
This might help you:
http://cxf.apache.org/faq.html#FAQ-AreJAX-WSclientproxiesthreadsafe?

Colm.

On Tue, Dec 17, 2019 at 8:29 AM Bernard Maassen <bm...@een.com> wrote:

> I was wondering if it's possible to reuse the same client/proxy for
> multiple endpoints.
> My situation:
> * i generated the client java code from the wsdl
> * client is created using JaxWsProxyFactoryBean.create( service.class )
> * this is repeated a few thousand times, for different ip/port user/pass
>
> The issue:
> each proxy takes about 2mb of memory, which if it's just one client is
> not really an issue, but when having a few thousand it adds up. And as
> the only thing that is really different between them is the ip/port
> and user/password used, i have the feeling it could/should be done
> differently.
>
> Any thoughts?
>
> Bernard
>