Skip to content

Commit 7bff26a

Browse files
author
vishalup29
committed
Issue open-feature/java-sdk#1486 Deprecate contrib multi-provider and redirect users to SDK implementation.
Signed-off-by: vishalup29 <[email protected]>
1 parent 26276ca commit 7bff26a

File tree

5 files changed

+49
-11
lines changed

5 files changed

+49
-11
lines changed

providers/multiprovider/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# OpenFeature Multi-Provider for Java
22

3+
> **Deprecated:** This module has been superseded by the multi-provider implementation in the **core Java SDK**.
4+
> 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.
5+
> This artifact remains available for backwards compatibility but may be removed in a future release.
6+
37
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.
48
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.
59

@@ -14,6 +18,11 @@ Some examples:
1418
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.
1519
By using the FirstSuccessfulStrategy, the Multi-Provider will move on to the next provider in the list if an error is thrown.
1620

21+
> **Recommended replacement:** For new integrations, see the multi-provider in the core SDK:
22+
>
23+
> - Class: [`dev.openfeature.sdk.multiprovider.MultiProvider`](https://github.com/open-feature/java-sdk/blob/main/src/main/java/dev/openfeature/sdk/multiprovider/MultiProvider.java)
24+
> - Documentation: refer to the [Java SDK README](https://github.com/open-feature/java-sdk#openfeature-java-sdk) Javadoc.
25+
1726
## Strategies
1827

1928
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
4958

5059
## Installation
5160

61+
> **Note:** The following coordinates are kept for existing users of the contrib multi-provider.
62+
> New projects should prefer the core SDK dependency and its `dev.openfeature.sdk.providers.multiprovider.MultiProvider` implementation.
63+
5264
<!-- x-release-please-start-version -->
5365

5466
```xml
@@ -63,6 +75,8 @@ Rather than making assumptions about when to use a provider’s result and when
6375
<!-- x-release-please-end-version -->
6476

6577
## Usage
78+
Legacy usage: This example shows how to use the contrib multi-provider.
79+
For new code, use dev.openfeature.sdk.providers.multiprovider.MultiProvider from the core SDK and follow the examples in the Java SDK README.
6680

6781
Usage example:
6882

providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/FirstMatchStrategy.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@
1212
import lombok.extern.slf4j.Slf4j;
1313

1414
/**
15-
* First match strategy. Return the first result returned by a provider. Skip providers that
16-
* indicate they had no value due to FLAG_NOT_FOUND. In all other cases, use the value returned by
17-
* the provider. If any provider returns an error result other than FLAG_NOT_FOUND, the whole
18-
* evaluation should error and “bubble up” the individual provider’s error in the result. As soon as
19-
* a value is returned by a provider, the rest of the operation should short-circuit and not call
20-
* the rest of the providers.
15+
* First Match strategy.
16+
* <p>Return the first result returned by a provider. Skip providers that indicate they had no
17+
* value due to {@code FLAG_NOT_FOUND}. In all other cases, use the value returned by the
18+
* provider. If any provider returns an error result other than {@code FLAG_NOT_FOUND}, the whole
19+
* evaluation should error and “bubble up” the individual provider’s error in the result. As soon
20+
* as a value is returned by a provider, the rest of the operation should short-circuit and not
21+
* call the rest of the providers.</p>
22+
*
23+
* @deprecated Use {@link dev.openfeature.sdk.multiprovider.FirstMatchStrategy}
24+
* from the core Java SDK instead.
2125
*/
2226
@Slf4j
2327
@NoArgsConstructor
28+
@Deprecated
2429
public class FirstMatchStrategy implements Strategy {
2530

2631
/**

providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/FirstSuccessfulStrategy.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@
1010
import lombok.extern.slf4j.Slf4j;
1111

1212
/**
13-
* First Successful Strategy. Similar to “First Match”, except that errors from evaluated providers
14-
* do not halt execution. Instead, it will return the first successful result from a provider. If no
15-
* provider successfully responds, it will throw an error result.
13+
* First Successful strategy.
14+
* <p>Similar to “First Match”, except that errors from evaluated providers do not halt execution.
15+
* Instead, it will return the first successful result from a provider. If no provider successfully
16+
* responds, it will throw an error result.</p>
17+
*
18+
* @deprecated Use {@link dev.openfeature.sdk.multiprovider.FirstSuccessfulStrategy}
19+
* from the core Java SDK instead.
1620
*/
1721
@Slf4j
1822
@NoArgsConstructor
23+
@Deprecated
1924
public class FirstSuccessfulStrategy implements Strategy {
2025

2126
@Override

providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/MultiProvider.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@
2121
import lombok.extern.slf4j.Slf4j;
2222
import org.json.JSONObject;
2323

24-
/** Provider implementation for Multi-provider. */
24+
/**
25+
* Multi-provider implementation that composes multiple providers.
26+
* <p>This implementation lives in the contrib repository and is kept for backwards compatibility
27+
* with existing users.</p>
28+
*
29+
* @deprecated Use {@link dev.openfeature.sdk.multiprovider.MultiProvider}
30+
* from the core Java SDK instead.
31+
*/
2532
@Slf4j
33+
@Deprecated
2634
public class MultiProvider extends EventProvider {
2735

2836
@Getter

providers/multiprovider/src/main/java/dev/openfeature/contrib/providers/multiprovider/Strategy.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
import java.util.Map;
77
import java.util.function.Function;
88

9-
/** strategy. */
9+
/**
10+
* Strategy for evaluating flags across multiple providers.
11+
*
12+
* @deprecated Use the strategy classes in {@code dev.openfeature.sdk.multiprovider}
13+
* from the core Java SDK instead.
14+
*/
15+
@Deprecated
1016
public interface Strategy {
1117
<T> ProviderEvaluation<T> evaluate(
1218
Map<String, FeatureProvider> providers,

0 commit comments

Comments
 (0)