Define Control Points
Aperture Java SDK core library can be used to define feature control points within a Java service.
The next step is to create an Aperture Client instance, for which the address of the organization created in Aperture Cloud and API key are needed. You can locate both these details by clicking on the Aperture tab in the sidebar menu of Aperture Cloud.
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 apiKey = "API_KEY";
The created instance can then be used to start a flow:
The above code snippet is making startFlow
calls to Aperture. For this call,
it is important to specify the control point (featureName
in the example) and
business labels that will be aligned with the policy created in Aperture Cloud.
For request prioritization use cases, it's important to set a higher gRPC
deadline. This parameter specifies the maximum duration a request can remain in
the queue. For each flow that is started, a shouldRun
decision is made,
determining whether to allow the request into the system or to rate limit it. In
this example, we only see response returns, but in a production environment,
actual business logic can be executed when a request is allowed. It is important
to make the end
call made after processing each request, to send telemetry
data that would provide granular visibility for each flow.
For more context on using Aperture Java SDK to set feature control points, refer to the example app available in the repository.