open-feature / open-feature/java-sdk-contrib
[OFREP] Add SSE event stream support
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 49
- Forks
- 81
- Avg merge
- 20h 3m
- Merged PRs (30d)
- 6
Description
Context
ADR-0008 defines Server-Sent Events (SSE) as an optional real-time change notification mechanism for OFREP. The OpenAPI spec PR adds the corresponding eventStreams field to evaluation responses.
The OFREP provider currently does stateless per-request evaluation with no change detection. SSE support would allow the provider to receive real-time notifications when the underlying flag configuration changes and emit PROVIDER_CONFIGURATION_CHANGED events so the host application can react.
Scope
Parse the optional eventStreams array from the POST /ofrep/v1/evaluate/flags/{key} response and connect to any entries with type: "sse". On receiving a refetchEvaluation event, emit a PROVIDER_CONFIGURATION_CHANGED event.
1. Parse eventStreams and manage SSE connections (High)
- On a successful evaluation response, check for an
eventStreamsarray - For each entry with
type: "sse", resolve the connection URL from eitherurlorendpoint.origin + endpoint.requestUri - Ignore entries with unknown types for forward compatibility
- Maintain a single SSE connection (deduplicate across evaluation responses returning the same URL)
2. Handle change events (High)
- On receiving an event with
data.type: "refetchEvaluation", emitPROVIDER_CONFIGURATION_CHANGED - On SSE connection failure, continue reconnection attempts
3. Inactivity timeout (Low)
- Apply an effective
inactivityDelaySec: client override > response value > default120seconds - On timeout, close the connection; on resume, reconnect
References
- ADR-0008
- OpenAPI spec changes
- launchdarkly/okhttp-eventsource — Java SSE client library
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Java provider path that handles POST /ofrep/v1/evaluate/flags/{key}, then read ADR-0008 and the referenced OpenAPI changes for the eventStreams response shape. Done means SSE entries are connected and deduplicated, refetchEvaluation emits PROVIDER_CONFIGURATION_CHANGED, failures reconnect, and the inactivityDelaySec precedence is applied.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100