Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Reforge Java Sdk
# Reforge Java SDK

[![javadoc](https://javadoc.io/badge2/cloud.prefab/client/javadoc.svg)](https://javadoc.io/doc/cloud.prefab/client) FIXME
[![javadoc](https://javadoc.io/badge2/com.reforge/sdk/javadoc.svg)](https://javadoc.io/doc/com.reforge/sdk)
[![Better Uptime Badge](https://betteruptime.com/status-badges/v1/monitor/pdi9.svg)](https://betteruptime.com/?utm_source=status_badge)

Java (11+) Reforge SDK for FeatureFlags, Config as a Service: https://launch.reforge.com
Java (11+) Reforge SDK for FeatureFlags, Config as a Service: https://reforge.com

See full documentation [https://docs.prefab.cloud/docs/java-sdk/java](https://docs.prefab.cloud/docs/sdks/java)
See full documentation [https://docs.reforge.com/docs/java-sdk/java](https://docs.reforge.com/docs/sdks/java)

Maven
```xml
<dependency>
<groupId>com.reforge</groupId>
<artifactId>sdk</artifactId>
<version>TODO</version>
<version>0.3.26</version>
</dependency>
```


## Contributing to prefab-cloud-java
## Contributing to reforge-sdk-java

* Check out the latest `main` to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
Expand Down
45 changes: 19 additions & 26 deletions micronaut/README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,53 @@
# prefab-cloud-java
Java Client for Prefab LogLevels, FeatureFlags, Config as a Service: https://www.prefab.cloud
# reforge-sdk-java
Java Client for Reforge LogLevels, FeatureFlags, Config as a Service: https://reforge.com

See full documentation https://docs.prefab.cloud/docs/java-sdk/java
See full documentation https://docs.reforge.com/docs/java-sdk/java

# Micronaut Support

## Context Storage

Out of the box, the Prefab client includes the ThreadLocalContextStore which relies on the same Thread handling a HTTP Request.
Out of the box, the Reforge client includes the ThreadLocalContextStore which relies on the same Thread handling a HTTP Request.

Micronaut has an event based model, so state must be managed without ThreadLocals - to that end we provide the `ServerRequestContextStore` that uses the ServerRequestContext.
Micronaut has an event based model, so state must be managed without ThreadLocals - to that end we provide the `ServerRequestContextStore` that uses the ServerRequestContext.
_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._

### Usage

Maven

Maven
```xml
<dependency>
<groupId>cloud.prefab</groupId>
<artifactId>micronaut</artifactId>
<version>0.3.25</version>
<groupId>com.reforge</groupId>
<artifactId>sdk-micronaut-extension</artifactId>
<version>0.3.26</version>
</dependency>
```

The context store implementation is added to the Prefab `Options` class.
The context store implementation is added to the Reforge `Options` class.

You'll likely have a factory class like this one - see the `options.setContextStore(new PrefabMicronautStateStore());` in the sdk method
You'll likely have a factory class like this one - see the `options.setContextStore(new ServerRequestContextStore());` in the sdk method

```java
@Factory
public class PrefabFactory {
private static final Logger LOG = LoggerFactory.getLogger(PrefabFactory.class);
public class ReforgeFactory {
private static final Logger LOG = LoggerFactory.getLogger(ReforgeFactory.class);

@Singleton
public PrefabCloudClient sdk(Environment environment) {
public Sdk sdk(Environment environment) {
final Options options = new Options();
options.setPrefabEnvs(environment.getActiveNames().stream().toList());
options.setContextStore(new PrefabMicronautStateStore());
return new PrefabCloudClient(options);
options.setContextStore(new ServerRequestContextStore());
return new Sdk(options);
}

@Singleton
public FeatureFlagClient featureFlagClient(PrefabCloudClient sdk) {
public FeatureFlagClient featureFlagClient(Sdk sdk) {
return sdk.featureFlagClient();
}

@Context
public ConfigClient configClient(
PrefabCloudClient sdk
) {
ConfigClient configClient = sdk.configClient();
// install the logging filter at the same time
PrefabMDCTurboFilter.install(configClient);
return configClient;
@Singleton
public ConfigClient configClient(Sdk sdk) {
return sdk.configClient();
}
}
```
Expand Down
1 change: 1 addition & 0 deletions micronaut/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<artifactId>sdk-micronaut-extension</artifactId>
<name>Reforge SDK Extension for Micronaut</name>
<description>Micronaut integration for Reforge SDK to enable storage of Context in the Server Request Context</description>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<version>0.3.26</version>
<packaging>pom</packaging>
<name>Reforge SDK Parent POM</name>
<description>Parent POM for Reforge SDK modules providing feature flags, configuration management, and A/B testing capabilities</description>

<modules>
<module>micronaut</module>
Expand Down
12 changes: 6 additions & 6 deletions sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Reforge Java Sdk
# Reforge Java SDK

[![javadoc](https://javadoc.io/badge2/cloud.prefab/client/javadoc.svg)](https://javadoc.io/doc/cloud.prefab/client) FIXME
[![javadoc](https://javadoc.io/badge2/com.reforge/sdk/javadoc.svg)](https://javadoc.io/doc/com.reforge/sdk)
[![Better Uptime Badge](https://betteruptime.com/status-badges/v1/monitor/pdi9.svg)](https://betteruptime.com/?utm_source=status_badge)

Java (11+) Reforge SDK for FeatureFlags, Config as a Service: https://launch.reforge.com
Java (11+) Reforge SDK for FeatureFlags, Config as a Service: https://reforge.com

See full documentation https://docs.prefab.cloud/docs/java-sdk/java
See full documentation https://docs.reforge.com/docs/java-sdk/java


### Maven
```xml
<dependency>
<groupId>com.reforge</groupId>
<artifactId>sdk</artifactId>
<version>TODO</version>
<version>0.3.26</version>
</dependency>
```

Expand All @@ -25,7 +25,7 @@ For an uber-jar including relocated guava and failsafe dependencies add the "ube
<dependency>
<groupId>com.reforge</groupId>
<artifactId>sdk</artifactId>
<version>TODO</version>
<version>0.3.26</version>
<classifier>uberjar</classifier>
</dependency>
```
Expand Down