Java CXF代理客户端和@Suspended AsyncResponse

Java CXF代理客户端和@Suspended AsyncResponse,java,spring,asynchronous,jax-rs,cxf-client,Java,Spring,Asynchronous,Jax Rs,Cxf Client,JAX-RS 2.0长期运行的服务端点可以利用@Suspended注释和AsyncResponse为传入请求释放资源,而实际工作是在后台完成的。所有客户机示例——至少是我目前发现的示例——要么直接调用此类端点(普通http调用),要么使用JAX-RS客户机API。但是,我不知道如何将其与基于代理的API一起使用 给定使用@Suspended的REST端点: public interface HeavyLiftingService { @GET @Path("/heavylifting")

JAX-RS 2.0长期运行的服务端点可以利用
@Suspended
注释和
AsyncResponse
为传入请求释放资源,而实际工作是在后台完成的。所有客户机示例——至少是我目前发现的示例——要么直接调用此类端点(普通http调用),要么使用JAX-RS客户机API。但是,我不知道如何将其与基于代理的API一起使用

给定使用
@Suspended
的REST端点:

public interface HeavyLiftingService {
  @GET
  @Path("/heavylifting")
  public void heavyLifting(@Suspended final AsyncResponse aResponse);
}
它使用Spring实现:

@Component
public class HeavyLiftingServiceImpl implements HeavyLiftingService {
  @Override
  @Async
  public void heavyLifting(@Suspended final AsyncResponse aResponse) {
    final Result result = doHeavyLifting();
    aResponse.resume(result);
  }
}
以及基于代理的客户端,希望获得结果:

HeavyLiftingService proxy = JAXRSClientFactory.create("https://some-server.xyz", HeavyLiftingService.class);
proxy.heavyLifting(null); // what to put in here?
Result result = null; // how can I get the result?
显然有两个问题:

  • 我需要为
    heavyLifting
    方法提供什么作为
    AsyncResponse
    参数的值
  • 由于使用
    @Suspended
    的方法的返回类型必须为空,如何获得结果
  • 另一个问题是如何处理服务方法中的异常。异常是否会自动恢复响应并返回相应的错误状态