On 18/09/17 11:14, John D. Ament wrote:
I'm assuming you mean
https://github.com/apache/cxf/blob/master/distribution/src/main/release/samples/jax_rs/sse_cdi/src/main/java/demo/jaxrs/sse/StatsApplication.java#L39
?
That looks manually registered.
It should not be there,
we need to add a CXF @Provider(type=Feature) to
https://github.com/apache/cxf/blob/master/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseFeature.java
For my #1 its a CDI 2.0 feature. I think it'll work with this approach
though.
Any thoughts on the instability?
Well, it's a totally new feature. I know Andriy found some issues while
working on the integration with Atmosphere, my understanding there were
many timing related test issues, but what is more important is how it
works once the server is up an running, for a regular application, is
not stable in your case ?
Sergey
John
On Mon, Sep 18, 2017 at 5:09 AM Sergey Beryozkin <sberyoz...@gmail.com>
wrote:
Have a look at the sse cdi demo Andriy added to the distribution,
the feature (the one dealing with SSE) is expected to be auto-registered.
Re the transport id, by default CXF assumes it is 'plain' HTTP, so it
needs a hint.
What did you mean with 1) ?
Sergey
On 18/09/17 00:57, John D. Ament wrote:
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>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/