GO Feature Flag provider allows you to connect to your GO Feature Flag relay proxy instance.
To use your instance please follow this example:
import dev.openfeature.contrib.providers.gofeatureflag;
// ...
FeatureProvider provider = new GoFeatureFlagProvider(
GoFeatureFlagProviderOptions
.builder()
.endpoint("https://my-gofeatureflag-instance.org")
.timeout(1000)
.build());
OpenFeatureAPI.getInstance().setProviderAndWait(provider);
// ...
Client client = OpenFeatureAPI.getInstance().getClient("my-provider");
// targetingKey is mandatory for each evaluation
String targetingKey = "ad0c6f75-f5d6-4b17-b8eb-6c923d8d4698";
EvaluationContext evaluationContext = new ImmutableContext(targetingKey);
FlagEvaluationDetails<Boolean> booleanFlagEvaluationDetails = client.getBooleanDetails("feature_flag1", false, evaluationContext);
Boolean value = booleanFlagEvaluationDetails.getValue();
// ...
provider.shutdown();
You will have a new instance ready to be used with your open-feature
java SDK.
name | mandatory | Description |
---|---|---|
endpoint |
true |
endpoint contains the DNS of your GO Feature Flag relay proxy (ex: https://mydomain.com/gofeatureflagproxy/) |
timeout |
false |
timeout in millisecond we are waiting when calling the go-feature-flag relay proxy API. (default: 10000) |
maxIdleConnections |
false |
maxIdleConnections is the maximum number of connexions in the connexion pool. (default: 1000) |
keepAliveDuration |
false |
keepAliveDuration is the time in millisecond we keep the connexion open. (default: 7200000 (2 hours)) |
apiKey |
false |
If the relay proxy is configured to authenticate the requests, you should provide an API Key to the provider. Please ask the administrator of the relay proxy to provide an API Key. (This feature is available only if you are using GO Feature Flag relay proxy v1.7.0 or above). (default: null) |
enableCache |
false |
enable cache value. (default: true) |
cacheBuilder |
false |
If cache custom configuration is wanted, you should provide a cache builder. (default: null) |
flushIntervalMs |
false |
interval time we publish statistics collection data to the proxy. The parameter is used only if the cache is enabled, otherwise the collection of the data is done directly when calling the evaluation API. (default: 1000 ms) |
maxPendingEvents |
false |
max pending events aggregated before publishing for collection data to the proxy. When event is added while events collection is full, event is omitted. (default: 10000) |