Waiting for engine...
Skip to main content

Implement Gateway and GatewayConfiguration

Gateway and GatewayConfiguration are the foundation of every agent implementation. They define how the agent connects to your gateway and how it reads configuration values at startup.

Prerequisites

  • Java development environment configured
  • Agent SDK dependency added to your project
  • Familiarity with Java interfaces and class extension

Key concepts

TermDescription
GatewayBase class your implementation must extend. Represents the gateway connection.
GatewayConfigurationBase class for holding all configuration values needed to connect to your gateway.
GatewayConfigurationFactoryInterface that parses configuration values from the docker-compose.yml file into your GatewayConfiguration subclass.
GatewayFactoryInterface that creates instances of your Gateway subclass.

Create a project

Create a project and implement the interfaces declared here. This library includes the data model that the API Control Plane uses, as well as interfaces for all the handlers for the environment capabilities your gateway supports, such as component discovery and API metrics.

Extend Gateway and GatewayConfiguration

  1. Create a subclass of Gateway for your gateway type.

  2. Create a subclass of GatewayConfiguration. Add all fields required to establish connectivity to your gateway, for example, a hostname, username, and password.

  3. Implement GatewayConfigurationFactory using your GatewayConfiguration subclass. The parseConfiguration method receives properties from the docker-compose.yml file at agent startup and populates your configuration fields.

  4. Implement GatewayFactory using your Gateway subclass.

How configuration values flow

When you register a gateway in API Control Plane, the values you enter during registration are written into an automatically generated docker-compose.yml file. For example, if your GatewayConfiguration has a password field, a user entering examplePass during registration results in gateway.password=examplePass in the compose file.

At agent startup, GatewayConfigurationFactory::parseConfiguration reads those properties and populates your GatewayConfiguration instance.

Add every field your agent needs to connect to your gateway to your GatewayConfiguration subclass before you define the Platform Type properties in API Control Plane.

On this Page