Skip to main content
Version: 2.6.0

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:

    String agentHost = "localhost";
int agentPort = 8089;

ApertureSDK apertureSDK;

apertureSDK = ApertureSDK.builder()
.setHost(agentHost)
.setPort(agentPort)
.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");

Flow flow = apertureSDK.startFlow("featureName", labels);
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.