You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kalpak Gadre <ka...@gmail.com> on 2015/06/09 20:40:41 UTC

Apache CXF in Play Framework

Hi,

I am working on a project which is developed using Play Framework. The
project needs to interact with a number of third party SOAP services. It is
very important for the system to be scalable by design and should allow
high number of concurrent requests. I understand that this can be achieved
using Async HTTP Transport.

For now, I am using Java interfaces and classes generated through wsdl2java
utility. Currently I have generated services with synchronous calls. I plan
to use -asyncMethods switch and generate asynchronous services.

I am trying to figure out how I can manage the threads used by async web
service calls.

Few questions I have are,

1. How can I control the thread pool / executor used by the WS client?
2. How can I shared the same thread pool / executor across multiple clients?
3. Does the Async HTTP transport use another thread pool / executor? Can it
also share the same with rest of the WS clients?
4. Do I need to create a spring config and create all the client beans
there to be able to manage them through single CXF instance (bus)? I wonder
if it is a good idea to independently create WS client instances?

Overall I hope I am not doing anything fundamentally wrong. I hope that
using async client methods and async transport the system will allow
multiple concurrent calls.

Thanks,

Kalpak

Re: Apache CXF in Play Framework

Posted by Kalpak Gadre <ka...@gmail.com>.
Forgot to mention, I am using CXF 3.1.0.

On Thu, Jun 11, 2015 at 7:30 PM, Kalpak Gadre <ka...@gmail.com> wrote:

> Hi,
>
> I figured that the Client classes that are generated have an ability to
> set an executor on it, although I have now managed to migrate to Spring IOC
> (I was using Guice) which has allowed to me make things more easier to
> configure.
>
> I have declared client beans in Spring XML like below and I am able to
> inject them into other components.
>
> <jaxws:client id="lntSoapClient"
>       serviceClass="com.test.MyServiceInterface"
>       address="http://somedomain/services/Service1"
>       bus="mybus">
> <jaxws:properties>
>     <entry key="executor" value-ref="akkaExecutor"/>
> </jaxws:properties>
> </jaxws:client>
>
> I have also managed to enable the Async HTTP transport working which has
> given noticeable performance gain (I am still using synchronous method
> calls, I am puzzle about this)
>
> What I am trying to understand now is,
>
> 1. if I call an async method which returns a Future, which thread-pool
> does it use?
> 2. Is there any way I can control the thread-pool each client bean uses?
> 3. Does the Async Transport use its own thread-pool? Can I make it use
> external thread-pool?
>
> I have not found a way to set an Executor on the client proxy when I am
> creating them through Spring configuration.
>
> Any pointers?
>
> Thanks,
> Kalpak
>
>
> On Wed, Jun 10, 2015 at 12:10 AM, Kalpak Gadre <ka...@gmail.com> wrote:
>
>> Hi,
>>
>> I am working on a project which is developed using Play Framework. The
>> project needs to interact with a number of third party SOAP services. It is
>> very important for the system to be scalable by design and should allow
>> high number of concurrent requests. I understand that this can be achieved
>> using Async HTTP Transport.
>>
>> For now, I am using Java interfaces and classes generated through
>> wsdl2java utility. Currently I have generated services with synchronous
>> calls. I plan to use -asyncMethods switch and generate asynchronous
>> services.
>>
>> I am trying to figure out how I can manage the threads used by async web
>> service calls.
>>
>> Few questions I have are,
>>
>> 1. How can I control the thread pool / executor used by the WS client?
>> 2. How can I shared the same thread pool / executor across multiple
>> clients?
>> 3. Does the Async HTTP transport use another thread pool / executor? Can
>> it also share the same with rest of the WS clients?
>> 4. Do I need to create a spring config and create all the client beans
>> there to be able to manage them through single CXF instance (bus)? I wonder
>> if it is a good idea to independently create WS client instances?
>>
>> Overall I hope I am not doing anything fundamentally wrong. I hope that
>> using async client methods and async transport the system will allow
>> multiple concurrent calls.
>>
>> Thanks,
>>
>> Kalpak
>>
>>
>
>
> --
> Kalpak R. Gadre
>



-- 
Kalpak R. Gadre

Re: Apache CXF in Play Framework

Posted by Daniel Kulp <dk...@apache.org>.
> On Jun 11, 2015, at 10:00 AM, Kalpak Gadre <ka...@gmail.com> wrote:
> 
> 
> What I am trying to understand now is,
> 
> 1. if I call an async method which returns a Future, which thread-pool does
> it use?

Kind of depends on the transport.   With the  HTTP transport, it would be the default WorkQueue obtained form the WorkQueueManager unless you have one specifically configured for the http-conduits. (work queue named “http-conduit)


> 2. Is there any way I can control the thread-pool each client bean uses?

The executor should work fine for this.  Without the executor, for the regular HTTP transport, likely yes.   You would just need to create a new Bus for each client if they each need their own thread pool.   


> 3. Does the Async Transport use its own thread-pool? Can I make it use
> external thread-pool?

The async transport has two thread pools that are considered.   One thread pool is the WorkQueue mentioned above for the threads where the “CXF” processing is done.   The other is the pool internal to the async client that it uses for decoding response packets and such.    I don’t know much about the latter.   There are settings for controlling the size, but don’t know much more than that.   The executor can be used instead of the workqueue for the latter. 


> I have not found a way to set an Executor on the client proxy when I am
> creating them through Spring configuration.

Not seeing anything “easy” on that.  Hmm…

Dan


> 
> Any pointers?
> 
> Thanks,
> Kalpak
> 
> 
> On Wed, Jun 10, 2015 at 12:10 AM, Kalpak Gadre <ka...@gmail.com> wrote:
> 
>> Hi,
>> 
>> I am working on a project which is developed using Play Framework. The
>> project needs to interact with a number of third party SOAP services. It is
>> very important for the system to be scalable by design and should allow
>> high number of concurrent requests. I understand that this can be achieved
>> using Async HTTP Transport.
>> 
>> For now, I am using Java interfaces and classes generated through
>> wsdl2java utility. Currently I have generated services with synchronous
>> calls. I plan to use -asyncMethods switch and generate asynchronous
>> services.
>> 
>> I am trying to figure out how I can manage the threads used by async web
>> service calls.
>> 
>> Few questions I have are,
>> 
>> 1. How can I control the thread pool / executor used by the WS client?
>> 2. How can I shared the same thread pool / executor across multiple
>> clients?
>> 3. Does the Async HTTP transport use another thread pool / executor? Can
>> it also share the same with rest of the WS clients?
>> 4. Do I need to create a spring config and create all the client beans
>> there to be able to manage them through single CXF instance (bus)? I wonder
>> if it is a good idea to independently create WS client instances?
>> 
>> Overall I hope I am not doing anything fundamentally wrong. I hope that
>> using async client methods and async transport the system will allow
>> multiple concurrent calls.
>> 
>> Thanks,
>> 
>> Kalpak
>> 
>> 
> 
> 
> -- 
> Kalpak R. Gadre

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


Re: Apache CXF in Play Framework

Posted by Kalpak Gadre <ka...@gmail.com>.
Hi,

I figured that the Client classes that are generated have an ability to set
an executor on it, although I have now managed to migrate to Spring IOC (I
was using Guice) which has allowed to me make things more easier to
configure.

I have declared client beans in Spring XML like below and I am able to
inject them into other components.

<jaxws:client id="lntSoapClient"
      serviceClass="com.test.MyServiceInterface"
      address="http://somedomain/services/Service1"
      bus="mybus">
<jaxws:properties>
    <entry key="executor" value-ref="akkaExecutor"/>
</jaxws:properties>
</jaxws:client>

I have also managed to enable the Async HTTP transport working which has
given noticeable performance gain (I am still using synchronous method
calls, I am puzzle about this)

What I am trying to understand now is,

1. if I call an async method which returns a Future, which thread-pool does
it use?
2. Is there any way I can control the thread-pool each client bean uses?
3. Does the Async Transport use its own thread-pool? Can I make it use
external thread-pool?

I have not found a way to set an Executor on the client proxy when I am
creating them through Spring configuration.

Any pointers?

Thanks,
Kalpak


On Wed, Jun 10, 2015 at 12:10 AM, Kalpak Gadre <ka...@gmail.com> wrote:

> Hi,
>
> I am working on a project which is developed using Play Framework. The
> project needs to interact with a number of third party SOAP services. It is
> very important for the system to be scalable by design and should allow
> high number of concurrent requests. I understand that this can be achieved
> using Async HTTP Transport.
>
> For now, I am using Java interfaces and classes generated through
> wsdl2java utility. Currently I have generated services with synchronous
> calls. I plan to use -asyncMethods switch and generate asynchronous
> services.
>
> I am trying to figure out how I can manage the threads used by async web
> service calls.
>
> Few questions I have are,
>
> 1. How can I control the thread pool / executor used by the WS client?
> 2. How can I shared the same thread pool / executor across multiple
> clients?
> 3. Does the Async HTTP transport use another thread pool / executor? Can
> it also share the same with rest of the WS clients?
> 4. Do I need to create a spring config and create all the client beans
> there to be able to manage them through single CXF instance (bus)? I wonder
> if it is a good idea to independently create WS client instances?
>
> Overall I hope I am not doing anything fundamentally wrong. I hope that
> using async client methods and async transport the system will allow
> multiple concurrent calls.
>
> Thanks,
>
> Kalpak
>
>


-- 
Kalpak R. Gadre