diff --git a/providers/multiprovider/README.md b/providers/multiprovider/README.md index 8d8151265..038e31159 100644 --- a/providers/multiprovider/README.md +++ b/providers/multiprovider/README.md @@ -1,5 +1,9 @@ # OpenFeature Multi-Provider for Java +> **Deprecated:** This module has been superseded by the multi-provider implementation in the **core Java SDK**. +> For new projects, please use [`dev.openfeature.sdk.multiprovider.MultiProvider`](https://github.com/open-feature/java-sdk/blob/main/src/main/java/dev/openfeature/sdk/multiprovider/MultiProvider.java) from the core SDK instead of this contrib module. +> This artifact remains available for backwards compatibility but may be removed in a future release. + The OpenFeature Multi-Provider wraps multiple underlying providers in a unified interface, allowing the SDK client to transparently interact with all those providers at once. This allows use cases where a single client and evaluation interface is desired, but where the flag data should come from more than one source. @@ -14,6 +18,11 @@ Some examples: You can use the Multi-Provider to automatically fall back to a local configuration if an external vendor provider goes down, rather than using the default values. By using the FirstSuccessfulStrategy, the Multi-Provider will move on to the next provider in the list if an error is thrown. +> **Recommended replacement:** For new integrations, see the multi-provider in the core SDK: +> +> - Class: [`dev.openfeature.sdk.multiprovider.MultiProvider`](https://github.com/open-feature/java-sdk/blob/main/src/main/java/dev/openfeature/sdk/multiprovider/MultiProvider.java) +> - Documentation: refer to the [Java SDK README](https://github.com/open-feature/java-sdk#openfeature-java-sdk) Javadoc. + ## Strategies The Multi-Provider supports multiple ways of deciding how to evaluate the set of providers it is managing, and how to deal with any errors that are thrown. @@ -49,6 +58,9 @@ Rather than making assumptions about when to use a provider’s result and when ## Installation +> **Note:** The following coordinates are kept for existing users of the contrib multi-provider. +> New projects should prefer the core SDK dependency and its `dev.openfeature.sdk.providers.multiprovider.MultiProvider` implementation. + ```xml @@ -63,6 +75,8 @@ Rather than making assumptions about when to use a provider’s result and when ## Usage +Legacy usage: This example shows how to use the contrib multi-provider. +For new code, use dev.openfeature.sdk.providers.multiprovider.MultiProvider from the core SDK and follow the examples in the Java SDK README. Usage example: diff --git a/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/FirstMatchStrategy.java b/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/FirstMatchStrategy.java index 064e39140..3440aed9c 100644 --- a/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/FirstMatchStrategy.java +++ b/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/FirstMatchStrategy.java @@ -12,15 +12,21 @@ import lombok.extern.slf4j.Slf4j; /** - * First match strategy. Return the first result returned by a provider. Skip providers that - * indicate they had no value due to FLAG_NOT_FOUND. In all other cases, use the value returned by - * the provider. If any provider returns an error result other than FLAG_NOT_FOUND, the whole - * evaluation should error and “bubble up” the individual provider’s error in the result. As soon as - * a value is returned by a provider, the rest of the operation should short-circuit and not call - * the rest of the providers. + * First Match strategy. + * + *
Return the first result returned by a provider. Skip providers that indicate they had no + * value due to {@code FLAG_NOT_FOUND}. In all other cases, use the value returned by the + * provider. If any provider returns an error result other than {@code FLAG_NOT_FOUND}, the whole + * evaluation should error and “bubble up” the individual provider’s error in the result. As soon + * as a value is returned by a provider, the rest of the operation should short-circuit and not + * call the rest of the providers.
+ * + * @deprecated Use {@link dev.openfeature.sdk.multiprovider.FirstMatchStrategy} + * from the core Java SDK instead. */ @Slf4j @NoArgsConstructor +@Deprecated public class FirstMatchStrategy implements Strategy { /** diff --git a/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/FirstSuccessfulStrategy.java b/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/FirstSuccessfulStrategy.java index 377cc61ef..3b683aa0b 100644 --- a/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/FirstSuccessfulStrategy.java +++ b/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/FirstSuccessfulStrategy.java @@ -10,12 +10,18 @@ import lombok.extern.slf4j.Slf4j; /** - * First Successful Strategy. Similar to “First Match”, except that errors from evaluated providers - * do not halt execution. Instead, it will return the first successful result from a provider. If no - * provider successfully responds, it will throw an error result. + * First Successful strategy. + * + *Similar to “First Match”, except that errors from evaluated providers do not halt execution. + * Instead, it will return the first successful result from a provider. If no provider successfully + * responds, it will throw an error result.
+ * + * @deprecated Use {@link dev.openfeature.sdk.multiprovider.FirstSuccessfulStrategy} + * from the core Java SDK instead. */ @Slf4j @NoArgsConstructor +@Deprecated public class FirstSuccessfulStrategy implements Strategy { @Override diff --git a/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/MultiProvider.java b/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/MultiProvider.java index 2b660aec0..2aefe62af 100644 --- a/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/MultiProvider.java +++ b/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/MultiProvider.java @@ -21,8 +21,17 @@ import lombok.extern.slf4j.Slf4j; import org.json.JSONObject; -/** Provider implementation for Multi-provider. */ +/** + * Multi-provider implementation that composes multiple providers. + * + *This implementation lives in the contrib repository and is kept for backwards compatibility + * with existing users.
+ * + * @deprecated Use {@link dev.openfeature.sdk.multiprovider.MultiProvider} + * from the core Java SDK instead. + */ @Slf4j +@Deprecated public class MultiProvider extends EventProvider { @Getter diff --git a/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/Strategy.java b/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/Strategy.java index 7363c1266..1d3a76d78 100644 --- a/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/Strategy.java +++ b/providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/Strategy.java @@ -6,7 +6,13 @@ import java.util.Map; import java.util.function.Function; -/** strategy. */ +/** + * Strategy for evaluating flags across multiple providers. + * + * @deprecated Use the strategy classes in {@code dev.openfeature.sdk.multiprovider} + * from the core Java SDK instead. + */ +@Deprecated public interface Strategy {