OpenFeature Provider for Java SDK
Integrate OpenFeature with Harness FME in your Java applications to evaluate feature flags, manage contexts, and track events using a standardized SDK.
Integrate your Java applications with Harness FME using the Java OpenFeature Provider, a standardized, vendor-agnostic feature flagging API. This provider implements the OpenFeature specification and bridges the OpenFeature SDK with the Harness FME Java SDK.
This page walks you through installing, configuring, and using the Java OpenFeature provider to evaluate feature flags in your Java applications.
Before you begin
Before you begin, ensure you have the following:
A valid Harness FME SDK key for your project
A Java environment running version 11 or later
Access to your Maven build configuration
Version compatibility
Java
11+
@splitsoftware/split-openfeature-provider-java
≥ 1.2.1
OpenFeature Java SDK
≥ 1.0.0
Install the provider and dependencies
Add the Harness FME OpenFeature provider dependency to your Maven build configuration.
<dependency>
<groupId>io.split.openfeature</groupId>
<artifactId>split-openfeature-provider</artifactId>
<version>1.2.1</version>
</dependency>Initialize the provider
You can instantiate and register the provider using your Harness FME SDK key.
Alternatively, if you want more control or need advanced initialization, you can create a SplitClient and provide it directly:
Construct an evaluation context
Provide an evaluation context with a targeting key to evaluate flags. The evaluation context passes targeting information such as user IDs, email addresses, or plan types for flag targeting.
For example:
If the same targeting key is reused across evaluations, set the context at the client or API level:
Or globally:
Once the context is set at the client or API level, you don’t need to provide it for each evaluation.
Evaluate with details
Use the get*Details(...) APIs to get flag values and metadata (such as variant, reason, error code, and configuration). The FME treatment configuration is returned as a raw JSON string under flagMetadata["config"].
For example:
Track events
The Harness FME OpenFeature provider supports tracking user actions or conversion events directly from your Java application.
To enable event tracking, your evaluation context must include the following:
A non-empty
targetingKeyA
trafficType(for example,"user"or"account")A non-blank event name
Optionally, you can include a numeric value and additional event properties. For more information, see Sending Events.
For example:
For more information, go to the Harness FME Java OpenFeature Provider GitHub repository.
Last updated
Was this helpful?