Skip to main content
Version: 1.1.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;
try {
apertureSDK = ApertureSDK.builder()
.setHost(agentHost)
.setPort(agentPort)
.setDuration(Duration.ofMillis(1000))
.build();
} catch (ApertureSDKException e) {
e.printStackTrace();
return;
}

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.accepted()) {
// do actual work
flow.end(FlowStatus.OK);
} else {
// handle flow rejection by Aperture Agent
flow.end(FlowStatus.Error);
}

For more context on how to use Java ApertureSDK to set feature Control Points, you can take a look at the example app available in our repository.