Skip to content

Latest commit

 

History

History
94 lines (66 loc) · 3.02 KB

File metadata and controls

94 lines (66 loc) · 3.02 KB

Quarkus Integration

A Quarkus extension that integrates Atmosphere with Quarkus 3.21+. Provides build-time annotation scanning via Jandex, Arc CDI integration, and GraalVM native image support.

Maven Coordinates

<dependency>
    <groupId>org.atmosphere</groupId>
    <artifactId>atmosphere-quarkus-extension</artifactId>
    <version>4.0.8-SNAPSHOT</version>
</dependency>

The deployment artifact (atmosphere-quarkus-extension-deployment) is resolved automatically by Quarkus.

Quick Start

application.properties

quarkus.atmosphere.packages=com.example.chat

Chat.java

@ManagedService(path = "/atmosphere/chat")
public class Chat {

    @Inject
    private BroadcasterFactory factory;

    @Inject
    private AtmosphereResource r;

    @Ready
    public void onReady() { }

    @Disconnect
    public void onDisconnect() { }

    @Message(encoders = {JacksonEncoder.class}, decoders = {JacksonDecoder.class})
    public Message onMessage(Message message) {
        return message;
    }
}

The extension auto-registers the Atmosphere servlet -- no web.xml or manual servlet registration needed. The same @ManagedService handler works across WAR, Spring Boot, and Quarkus -- only packaging and configuration differ.

Configuration Properties

All properties are under the quarkus.atmosphere.* prefix:

Property Default Description
quarkus.atmosphere.packages (none) Comma-separated packages to scan
quarkus.atmosphere.servlet-path /atmosphere/* Servlet URL mapping
quarkus.atmosphere.session-support false Enable HTTP session support
quarkus.atmosphere.broadcaster-class (default) Custom Broadcaster implementation
quarkus.atmosphere.broadcaster-cache-class (default) Custom BroadcasterCache implementation
quarkus.atmosphere.load-on-startup 1 Servlet load-on-startup order -- must be > 0
quarkus.atmosphere.heartbeat-interval-in-seconds (default) Heartbeat interval
quarkus.atmosphere.init-params (none) Map of raw ApplicationConfig init params

Note: load-on-startup must be > 0. Quarkus skips servlet initialization when this value is <= 0, unlike the standard Servlet spec where >= 0 means "load on startup."

Running

mvn quarkus:dev                          # dev mode with live reload
mvn clean package && java -jar target/quarkus-app/quarkus-run.jar  # JVM
mvn clean package -Pnative               # native image

GraalVM Native Image

./mvnw -Pnative package -pl samples/quarkus-chat
./samples/quarkus-chat/target/atmosphere-quarkus-chat-*-runner

Requires GraalVM JDK 21+ or Mandrel. Use -Dquarkus.native.container-build=true to build without a local GraalVM installation.

Samples

  • Quarkus Chat -- real-time chat with WebSocket and long-polling fallback

See Also