|
1 | | -# prefab-cloud-java |
2 | | -Java Client for Prefab LogLevels, FeatureFlags, Config as a Service: https://www.prefab.cloud |
| 1 | +# reforge-sdk-java |
| 2 | +Java Client for Reforge LogLevels, FeatureFlags, Config as a Service: https://reforge.com |
3 | 3 |
|
4 | | -See full documentation https://docs.prefab.cloud/docs/java-sdk/java |
| 4 | +See full documentation https://docs.reforge.com/docs/java-sdk/java |
5 | 5 |
|
6 | 6 | # Micronaut Support |
7 | 7 |
|
8 | 8 | ## Context Storage |
9 | 9 |
|
10 | | -Out of the box, the Prefab client includes the ThreadLocalContextStore which relies on the same Thread handling a HTTP Request. |
| 10 | +Out of the box, the Reforge client includes the ThreadLocalContextStore which relies on the same Thread handling a HTTP Request. |
11 | 11 |
|
12 | | -Micronaut has an event based model, so state must be managed without ThreadLocals - to that end we provide the `ServerRequestContextStore` that uses the ServerRequestContext. |
| 12 | +Micronaut has an event based model, so state must be managed without ThreadLocals - to that end we provide the `ServerRequestContextStore` that uses the ServerRequestContext. |
13 | 13 | _Note: Behind the scenes ServerRequestContext is based on a threadlocal, but micronaut's instrumentation code knows to copy this threadlocal between threads as the request moves through processing._ |
14 | 14 |
|
15 | 15 | ### Usage |
16 | 16 |
|
17 | 17 | Maven |
18 | 18 |
|
19 | | -Maven |
20 | 19 | ```xml |
21 | 20 | <dependency> |
22 | | - <groupId>cloud.prefab</groupId> |
23 | | - <artifactId>micronaut</artifactId> |
24 | | - <version>0.3.25</version> |
| 21 | + <groupId>com.reforge</groupId> |
| 22 | + <artifactId>sdk-micronaut-extension</artifactId> |
| 23 | + <version>0.3.26</version> |
25 | 24 | </dependency> |
26 | 25 | ``` |
27 | 26 |
|
28 | | -The context store implementation is added to the Prefab `Options` class. |
| 27 | +The context store implementation is added to the Reforge `Options` class. |
29 | 28 |
|
30 | | -You'll likely have a factory class like this one - see the `options.setContextStore(new PrefabMicronautStateStore());` in the sdk method |
| 29 | +You'll likely have a factory class like this one - see the `options.setContextStore(new ServerRequestContextStore());` in the sdk method |
31 | 30 |
|
32 | 31 | ```java |
33 | 32 | @Factory |
34 | | -public class PrefabFactory { |
35 | | - private static final Logger LOG = LoggerFactory.getLogger(PrefabFactory.class); |
| 33 | +public class ReforgeFactory { |
| 34 | + private static final Logger LOG = LoggerFactory.getLogger(ReforgeFactory.class); |
36 | 35 |
|
37 | 36 | @Singleton |
38 | | - public PrefabCloudClient sdk(Environment environment) { |
| 37 | + public Sdk sdk(Environment environment) { |
39 | 38 | final Options options = new Options(); |
40 | | - options.setPrefabEnvs(environment.getActiveNames().stream().toList()); |
41 | | - options.setContextStore(new PrefabMicronautStateStore()); |
42 | | - return new PrefabCloudClient(options); |
| 39 | + options.setContextStore(new ServerRequestContextStore()); |
| 40 | + return new Sdk(options); |
43 | 41 | } |
44 | 42 |
|
45 | 43 | @Singleton |
46 | | - public FeatureFlagClient featureFlagClient(PrefabCloudClient sdk) { |
| 44 | + public FeatureFlagClient featureFlagClient(Sdk sdk) { |
47 | 45 | return sdk.featureFlagClient(); |
48 | 46 | } |
49 | 47 |
|
50 | | - @Context |
51 | | - public ConfigClient configClient( |
52 | | - PrefabCloudClient sdk |
53 | | - ) { |
54 | | - ConfigClient configClient = sdk.configClient(); |
55 | | - // install the logging filter at the same time |
56 | | - PrefabMDCTurboFilter.install(configClient); |
57 | | - return configClient; |
| 48 | + @Singleton |
| 49 | + public ConfigClient configClient(Sdk sdk) { |
| 50 | + return sdk.configClient(); |
58 | 51 | } |
59 | 52 | } |
60 | 53 | ``` |
|
0 commit comments