Search in sources :

Example 1 with SseAtmosphereInterceptor

use of org.apache.cxf.jaxrs.sse.atmosphere.SseAtmosphereInterceptor in project cxf by apache.

the class AtmosphereSseServletDestination method create.

private AtmosphereFramework create() {
    final AtmosphereFramework instance = new AtmosphereFramework(true, false);
    instance.interceptor(new SseAtmosphereInterceptor());
    instance.addInitParameter(ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT, "true");
    instance.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT, "true");
    instance.addInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, "true");
    instance.addInitParameter(ApplicationConfig.CLOSE_STREAM_ON_CANCEL, "true");
    // Atmosphere does not limit amount of threads and application can crash in no time
    // https://github.com/Atmosphere/atmosphere/wiki/Configuring-Atmosphere-for-Performance
    instance.addInitParameter(ApplicationConfig.BROADCASTER_MESSAGE_PROCESSING_THREADPOOL_MAXSIZE, "20");
    instance.addInitParameter(ApplicationConfig.BROADCASTER_ASYNC_WRITE_THREADPOOL_MAXSIZE, "20");
    // workaround for atmosphere's jsr356 initialization requiring servletConfig
    instance.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true");
    instance.setBroadcasterCacheClassName(UUIDBroadcasterCache.class.getName());
    instance.addAtmosphereHandler("/", new DestinationHandler());
    return instance;
}
Also used : SseAtmosphereInterceptor(org.apache.cxf.jaxrs.sse.atmosphere.SseAtmosphereInterceptor) AtmosphereFramework(org.atmosphere.cpr.AtmosphereFramework) UUIDBroadcasterCache(org.atmosphere.cache.UUIDBroadcasterCache)

Aggregations

SseAtmosphereInterceptor (org.apache.cxf.jaxrs.sse.atmosphere.SseAtmosphereInterceptor)1 UUIDBroadcasterCache (org.atmosphere.cache.UUIDBroadcasterCache)1 AtmosphereFramework (org.atmosphere.cpr.AtmosphereFramework)1