Feature: Add Feature refresh listeners#215
Open
vazarkevych wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature: Feature Refresh Listeners
Summary
This update adds feature refresh listener support to the Java SDK.
Consumers can now subscribe to feature refresh events and react when feature definitions are refreshed successfully or when a refresh attempt fails. The event payload is metadata-only and does not expose feature definitions directly.
This allows SDK users to observe refresh lifecycle events, trigger custom logging or monitoring, and integrate refresh status with their own application workflows.
What Changed
Feature Refresh Listener API
Added client-level APIs for managing feature refresh listeners:
addFeatureRefreshListener(...)removeFeatureRefreshListener(...)subscribeFeatureRefreshListener(...)The
subscribeFeatureRefreshListener(...)API returns aFeatureRefreshSubscription, which provides an idempotent cleanup mechanism for unsubscribing listeners.Feature Refresh Event Metadata
Added
FeatureRefreshEventto provide metadata about feature refresh results.Listeners can now receive events when:
The event is intentionally metadata-only, so listener consumers can react to refresh status without directly depending on feature payload internals.
Listener Dispatch Support
Feature refresh listener dispatch is now supported across the refresh flow, including:
GrowthBookClientGBFeaturesRepositoryNativeJavaGbFeatureRepositoryLocalGbFeatureRepositoryThis ensures refresh events are propagated consistently across client-level and repository-level refresh operations.
Listener Failure Isolation
Listener execution is isolated from the SDK refresh flow.
If a listener throws an exception:
This prevents consumer-side listener failures from impacting core SDK behavior.
Optional Listener Executor
Added optional executor support through:
This allows consumers to control how listener callbacks are dispatched, including custom threading or asynchronous execution strategies.
Repository Initialization Refactor
Refactored
GrowthBookClientrepository initialization into an internal provider.This keeps repository creation and lifecycle handling more centralized, while preserving the public SDK behavior.