Quarkus Real-Time Events
This guide adds an SSE events proxy endpoint to the Quarkus tutorial app. For full details on event kinds, format, and connection lifecycle, see Real-Time Events.
Prerequisites
Starting checkpoint: java/quarkus/examples/doc-checkpoints/03-with-history
SSE Events Proxy
Checkpoint 03b adds an events proxy endpoint that forwards SSE from Memory Service to the frontend:
EventsResource.java
package org.acme;
import io.github.chirino.memory.runtime.MemoryServiceProxy;
import io.github.chirino.memory.runtime.MemoryServiceProxy.EventNotification;
import io.smallrye.mutiny.Multi;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
@Path("/v1/events")
@ApplicationScoped
public class EventsResource {
@Inject MemoryServiceProxy proxy;
@GET
@Produces(MediaType.SERVER_SENT_EVENTS)
public Multi<EventNotification> streamEvents(@QueryParam("kinds") String kinds) {
return proxy.streamEvents(kinds);
}
} Why proxy? The agent app sits between the frontend and Memory Service. Proxying the SSE stream lets the app forward the caller’s Bearer token for authorization while injecting the agent’s API key for service authentication. Frontends never talk directly to Memory Service.
Connecting
Subscribe to events through the agent app:
curl -N -H "Authorization: Bearer $(get-token)" \
http://localhost:9090/v1/events
Filter to specific event kinds:
curl -N -H "Authorization: Bearer $(get-token)" \
"http://localhost:9090/v1/events?kinds=conversation,entry"
Next Steps
- Real-Time Events — full reference for event kinds, format, and connection lifecycle
- Service Configuration — event bus settings