Sergey,

I think you're mixing emails (the email on dev@ is unrelated).

On Sun, Feb 4, 2018 at 12:53 PM Sergey Beryozkin <sberyoz...@gmail.com>
wrote:

> That dependency you referred to should let you do:
>
>   @Path("/")
>   public class RestController {
>        @GET
>        @Produces(MediaType.APPLICATION_JSON)
>        public Flux doGet(@Suspended AsyncResponse asyncResponse) {
>            ClientBuilder.newClient()
>                    .register(MyAppFeature.class)
>                    .target("https://postman-echo.com/get";)
>                    .queryParam("arg1", "arg1")
>                    .queryParam("arg2", "arg2")
>                    .request(MediaType.APPLICATION_JSON_TYPE)
>                    .rx(ReactorInvoker.class)
>                    .get(JsonObject.class);
>   }
>
> Not sure why Continuation is not init-ed though, something to do with
> the servlet setup
>

Anything you can suggest to debug through?

I'm following the async example I wrote, but within a servlet container
(I'm assuming the systests are running a jetty instance).


>
> Sergey
>
>
>
> On 04/02/18 16:16, John D. Ament wrote:
> > BTW, sample project can be found @
> > https://github.com/johnament/cxf-demo-reactive-cdi
> >
> >
> > On Sun, Feb 4, 2018 at 11:13 AM John D. Ament <johndam...@apache.org>
> wrote:
> >
> >> I built a simple webapp (WAR file, deploying to Tomcat) that depends on
> >> the CXF 3.2.2 libraries + Weld 3.0.2.  I don't believe CDI has anything
> to
> >> do with my problem though.
> >>
> >> I registered a feature/server customizer that can deal with the invoker
> >> logic required, and provided a rest controller that simply invokes the
> >> postman echo service
> >>
> >> Feature/Extension:
> >>
> >> @ApplicationScoped
> >> public class MyAppFeature implements Feature,
> >> JAXRSServerFactoryCustomizationExtension {
> >>      public boolean configure(FeatureContext featureContext) {
> >>          featureContext.register(JsrProvider.class);
> >>          featureContext.register(ReactorInvokerProvider.class);
> >>          return true;
> >>      }
> >>
> >>      @Override
> >>      public void customize(JAXRSServerFactoryBean
> jaxrsServerFactoryBean) {
> >>          ReactorInvoker invoker = new ReactorInvoker();
> >>          invoker.setUseStreamingSubscriberIfPossible(false);
> >>          jaxrsServerFactoryBean.setInvoker(invoker);
> >>          StreamingResponseProvider<JsonObject> streamProvider = new
> >> StreamingResponseProvider<>();
> >>
> >>
> streamProvider.setProduceMediaTypes(Collections.singletonList("application/json"));
> >>          jaxrsServerFactoryBean.setProvider(streamProvider);
> >>          jaxrsServerFactoryBean.getOutInterceptors().add(new
> >> LoggingOutInterceptor());
> >>      }
> >> }
> >>
> >> RestController:
> >>
> >> @RequestScoped
> >> @Path("/")
> >> public class RestController {
> >>      @GET
> >>      @Produces(MediaType.APPLICATION_JSON)
> >>      public void doGet(@Suspended AsyncResponse asyncResponse) {
> >>          ClientBuilder.newClient()
> >>                  .register(MyAppFeature.class)
> >>                  .target("https://postman-echo.com/get";)
> >>                  .queryParam("arg1", "arg1")
> >>                  .queryParam("arg2", "arg2")
> >>                  .request(MediaType.APPLICATION_JSON_TYPE)
> >>                  .rx(ReactorInvoker.class)
> >>                  .get(JsonObject.class)
> >>                  .subscribe(new
> >> JsonStreamingAsyncSubscriber<>(asyncResponse));
> >>      }
> >> }
> >>
> >> When I attempt to invoke this endpoint, I see a NPE in the logs
> >>
> >> 04-Feb-2018 11:07:20.245 WARNING [http-nio-8080-exec-69]
> >> org.apache.cxf.phase.PhaseInterceptorChain.doDefaultLogging Interceptor
> for
> >> {http://rest.mycompany.com/}RestController has thrown exception,
> >> unwinding now
> >>   java.lang.NullPointerException
> >> at
> >>
> org.apache.cxf.jaxrs.impl.AsyncResponseImpl.initContinuation(AsyncResponseImpl.java:306)
> >> at
> >>
> org.apache.cxf.jaxrs.impl.AsyncResponseImpl.<init>(AsyncResponseImpl.java:68)
> >> at
> >>
> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:826)
> >> at
> >>
> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:795)
> >> at
> >>
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:214)
> >> at
> >>
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:78)
> >> at
> >>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> >> at
> >>
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> >> at
> >>
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
> >> at
> >>
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
> >> at
> >>
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
> >> at
> >>
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
> >> at
> >>
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:191)
> >> at
> >>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
> >> at
> >>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:225)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
> >> at
> >>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
> >> at
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> >> at
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >> at
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >> at
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> >> at
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> >> at
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
> >> at
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
> >> at
> >>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
> >> at
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
> >> at
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
> >> at
> >>
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
> >> at
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
> >> at
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
> >> at
> >>
> org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
> >> at
> >>
> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
> >> at
> >>
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
> >> at
> >> org.apache.tomcat.util.net
> .NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
> >> at
> >> org.apache.tomcat.util.net
> .SocketProcessorBase.run(SocketProcessorBase.java:49)
> >> at
> >>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> >> at
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> >> at
> >>
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> >> at java.lang.Thread.run(Thread.java:748)
> >>
> >> Is there anything else that needs to happen to register the invoker to
> >> handle async responses?
> >>
> >> John
> >>
> >>
> >
>
>

Reply via email to