Waiting for engine...
Skip to main content

Implement Handlers and Capabilities

Handlers define what your agent can do. Capabilities tell API Control Plane which of those operations to call. You must implement both for any functionality you want to expose.

Prerequisites

Key concepts

TermDescription
HandlerInterface containing the methods for a specific area of functionality, such as API discovery or plan deployment.
HandlerFactoryInterface that creates instances of a Handler.
CapabilityA named, versioned flag that tells API Control Plane which Handler methods your agent supports.
CapabilityFactoryInterface your agent implements to report its supported capabilities and versions.
DiagnosticsServiceInterface your agent must implement so API Control Plane can display the gateway connection status.

Implement Handlers and HandlerFactories

For each area of functionality you want to support:

  1. Implement the Handler interface (for example, ApiDiscoveryHandler) with the required methods.
  2. Implement the corresponding HandlerFactory interface (for example, ApiDiscoveryHandlerFactory).
  3. Return a new instance of your HandlerFactory from the appropriate GatewayManager::getXFactory method. For details, see Implement GatewayManager.

If you implement a Handler method but do not report the corresponding capability, API Control Plane will not call that method. If you report a capability but do not implement the required methods, an UnsupportedOperationException is thrown when that operation is attempted.

Implement CapabilityFactory

Implement CapabilityFactory to report which capabilities your agent supports and at which versions. Report only the capabilities whose required methods you have fully implemented.

Implement DiagnosticsService

Implement DiagnosticsService and DiagnosticsServiceFactory so API Control Plane can display the connection status of your gateway. Without this implementation, the gateway status will not appear correctly in the UI.

Supported capabilities

CapabilityRequired implementationVersion to report
ApiDiscoveryApiDiscoveryHandler::discoverApis1
ComponentDiscoveryComponentDiscoveryHandler::discoverPlansAndApplications1
ComponentDeploymentPlanHandler::deploy and undeploy; SubscriptionHandler::deploy and undeploy; ApplicationHandler::deploy and undeploy3
CustomFieldDiscoveryCustomFieldDiscoveryHandler::discoverCustomFields1
ApiMetricsMetricsHandler::get for requests of type API1
ApplicationMetricsMetricsHandler::get for requests of type APPLICATION1
RawMetricsMetricsHandler::fetch for requests of type API and/or APPLICATION1
ApiImportApiImportExportHandler::import; ApiImportExportHandler::getBundleFileName1
ApiExportApiImportExportHandler::export; ApiImportExportHandler::getBundleFileName1
AccessPermissionRegenerationSubscriptionHandler::regenerateAccessPermission1
ApiProductsComponentDiscoveryHandler::discoverPlansAndApplications with API Products support; PlanHandler::deployForProduct1
OpenProxySpecDeploymentOpenProxySpecHandler::deploy2
OAuthConfigApplicationHandler::deploy with OAuth configuration support1
EnvironmentDiscoveryEnvironmentDiscoveryHandler::discover; ApiDiscoveryHandler::discoverApisInEnvironment; ComponentDiscoveryHandler::discoverPlansAndApplicationsInEnvironment1

Capability behavior notes

RawMetrics: When you report this capability, API Control Plane uses only MetricsHandler::fetch for metrics retrieval. MetricsHandler::get is not called.

ApiProducts: When you report this capability, API Control Plane uses only PlanHandler::deployForProduct for plan deployment. PlanHandler::deploy is not called.

EnvironmentDiscovery: When you report this capability, API Control Plane uses only the discoverXInEnvironment methods. The standard discoverX methods are not called.

OpenProxySpecDeployment: The OpenProxySpecHandler::deployApi method targets an experimental v1.1 of the Open Proxy Specification. You can ignore this method until v1.1 is released.

BuildInfo, ProcessId, GatewayId: These are internal capabilities. Reporting or not reporting them has no effect on agent functionality.

On this Page