cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bence Takács (JIRA) <j...@apache.org>
Subject [jira] [Comment Edited] (CXF-5942) Non-blocking WS call with CXF
Date Thu, 14 Aug 2014 15:26:12 GMT

    [ https://issues.apache.org/jira/browse/CXF-5942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14097067#comment-14097067
] 

Bence Takács edited comment on CXF-5942 at 8/14/14 3:25 PM:
------------------------------------------------------------

Thanks! It works now.

BUT: The callback is not called, only if one explicitly calling the Future.get() in the original
thread:
{code}
		Future future = client.getDataFromWebServiceAsync("" + current,
				new AsyncHandler<GetDataFromWebServiceResponse>() {
					@Override
					public void handleResponse(Response<GetDataFromWebServiceResponse> resp) {
						log.info("******** CALLBACK *******");
					}
				});

		future.get();
{code}

...which is blocking the original thread and makes the code synchronous again.

Anything I don't see? Tips to solve?


was (Author: bence.takacs):
Thanks! It works now.

BUT: The callback is not called, only if one explicitly calling the Future.get() in the original
thread:
{code}
		Future future = client.getDataFromWebServiceAsync("" + current,
				new AsyncHandler<GetDataFromWebServiceResponse>() {
					@Override
					public void handleResponse(Response<GetDataFromWebServiceResponse> resp) {
						log.info("******** CALLBACK *******");
					}
				});

		future.get();
{code}

...which is a blocking the original thread and makes the code synchronous again.

Anything I don't see? Tips to solve?

> Non-blocking WS call with CXF
> -----------------------------
>
>                 Key: CXF-5942
>                 URL: https://issues.apache.org/jira/browse/CXF-5942
>             Project: CXF
>          Issue Type: Wish
>          Components: Transports
>    Affects Versions: 3.0.0-milestone1
>            Reporter: Bence Takács
>            Priority: Minor
>              Labels: non-blocking
>
> It is not clear which are the use cases when one can use asynchronous client calls. The
possible use cases would be:
> - server-side implemented callback transport
> - server-side implemented polling transport
> - client-side only callback using non-blocking IO
> However http.asyncclient supports all of them, I see no sign of CXF supporting the last
one. Is there a way of calling a server this way?
> Using the configuration below I tried to call a WS this way, but CXF is always looking
for async binding on the server side (javax.xml.ws.WebServiceException: Could not find wsdl:binding
operation info for web method getDataFromWebService_Async). 
> Client configuration:
> {quote}
> <jaxws:client id="client"
>     serviceClass="my.sample.SampleWebService"
>     address="http://localhost:8080/sample-ws-cxf/SampleWebService">
>     <jaxws:properties>
>         <entry key="javax.xml.ws.client.connectionTimeout" value="10" />
>         <entry key="javax.xml.ws.client.receiveTimeout" value="11000" />
>         <entry key="org.apache.cxf.transport.http.async.usePolicy" value="ALWAYS"
/>
>         <entry key="org.apache.cxf.transport.http.async.ioThreadCount" value="2" />

>     </jaxws:properties>
> </jaxws:client>
> {quote}
> code:
> {quote}{noformat}
> client.getDataFromWebService_Async("" + id.getAndIncrement(), new AsyncHandler<Person>()
{
>     @Override
>     public void handleResponse(Response<Person> resp) {
>         Person person;
>         try {
>             person = resp.get();
>             ...
>         } catch (InterruptedException | ExecutionException e) {
>             ...
>         }
>     }
> });
> {noformat}{quote}
> If I log out the conduit, it tells that it is: org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit
( log.info(ClientProxy.getClient(client).getConduit().getClass().getName()); )
> I'm using cxf 3.0.1, and httpasyncclient version 4.0.1 with spring 3.2.2.RELEASE



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message