Ok, i was able to work a bit deeper into this. 1. the integration works, but firing async events doesn't work. I'm not sure it should, since you're just appending to the request; but I want to play with async requests a bit.
2. The integration seems flakey I'm afraid. I'll run a test, almost always it passes, but then every off test run will cause SSE to not get activated. I have no reproducer for this. When it does fail, all I get on the log is Sep 17, 2017 7:50:33 PM org.apache.cxf.transport.servlet.ServletController invoke WARNING: Can't find the request for http://my-hostname:4403/rest's Observer However, I see none of the atmosphere bootstrap occurring when this happens. Here's full logs for both failure and success: https://paste.apache.org/rWwj 3. I had to manually install the feature. Does CXF have any notion of automatically registering features? 4. I also had to customize the transport id. It would be good if this was automatic. John On Sun, Sep 17, 2017 at 4:21 PM John D. Ament <johndam...@apache.org> wrote: > I'm trying to create a very basic example of using SSE + CDI events. To > do that, I created a basic endpoint based on a CXF systest that I found, > but tried to adapt it to work with CDI. > > @Path("/sse") > @RequestScoped > public class SseEventEndpoint { > @Inject > private Event<SseEvent> event; > @Context > private Sse sse; > @GET > @Path("{connectionId}") > @Produces(MediaType.SERVER_SENT_EVENTS) > public void onEvent(@Context SseEventSink sink, > @PathParam("connectionId") final String id) { > System.out.println("Received request "+sse); > event.fireAsync(new SseEvent(sink, sse, id)); > } > } > > However, no matter what I do, the Sse object is null. Is there something > I need to do to enable Sse integration? This is what my dependencies look > like > > <dependency> > <groupId>org.apache.cxf</groupId> > <artifactId>cxf-integration-cdi</artifactId> > </dependency> > <dependency> > <groupId>org.apache.cxf</groupId> > <artifactId>cxf-rt-rs-client</artifactId> > </dependency> > <dependency> > <groupId>org.apache.cxf</groupId> > <artifactId>cxf-rt-rs-sse</artifactId> > </dependency> > <dependency> > <groupId>org.apache.cxf</groupId> > <artifactId>cxf-rt-transports-http</artifactId> > </dependency> >