Hi

The proxy invocations, sync or async ones, are not specified by JAX-RS at all,

However, this effort,
https://github.com/eclipse/microprofile-rest-client

attempts to standardize the proxy approach, please propose there,

Cheers, Sergey


On 08/12/17 16:00, Romain Quinio wrote:
Hello,

I was reviewing asynchronous JAX-RS client proxy invocations 
(http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-Asynchronousproxyinvocations),
 and if it would make sense to go one step further, and pass directly the 
InvocationCallback as a proxy method parameter (similar to AsyncHandler with 
asynchronous JAX-WS client proxy invocations).

Current way:

WebClient.getConfig(proxy).getRequestContext().put(InvocationCallback.class.getName(),
 callback);
assertNull(proxy.getBook(123L));

Improved way:

Future<?> future = proxy.getBookAsync(123L, callback);

The Future<?> object returned would allow to test if a response has arrived yet.
The #getBookAsync signature makes explicit whether the call is synchronous or 
asynchronous, otherwise it's unclear.
As asynchronous proxy invocations are unspecified by JAX-RS spec (I wonder why 
!), this would obviously be CXF specific, but the blog post 
http://sberyozkin.blogspot.fr/2016/06/asynchronous-jax-rs-proxies-in-cxf.html 
seemed to hint in that direction ?

As we're using swagger, that would likely mean tweaking swagger-codegen cxf 
language template with an option to generate these extra signatures as well.

Best Regards,
Romain Quinio

Reply via email to