Manually setting feature control points
Aperture Java SDK core library can be used to manually set feature control points within a Java service.
To do so, first create an instance of ApertureSDK:
API Key
You can create an API key for your project in the Aperture Cloud UI. For detailed instructions on locating API Keys, refer to the API Keys section.
String agentAddress = "ORGANIZATION.app.fluxninja.com:443";
String agentAPIKey = "API_KEY";
ApertureSDK apertureSDK;
apertureSDK = ApertureSDK.builder()
.setAddress(agentAddress)
.setAPIKey(agentAPIKey)
.setFlowTimeout(Duration.ofMillis(1000))
.build();
The created instance can then be used to start a flow:
Map<String, String> labels = new HashMap<>();
// business logic produces labels
labels.put("key", "value");
Boolean rampMode = false;
FeatureFlowParameters params = FeatureFlowParameters.newBuilder("featureName")
.setExplicitLabels(labels)
.setRampMode(rampMode)
.setFlowTimeout(Duration.ofMillis(1000))
.build();
Flow flow = apertureSDK.startFlow(params);
if (flow.shouldRun()) {
// do actual work
} else {
// handle flow rejection by Aperture Agent
flow.setStatus(FlowStatus.Error);
}
flow.end();
For more context on using Aperture Java SDK to set feature control points, refer to the example app available in the repository.