API (Sync)

Definition :

The Java client of the Optimization Server is a generated client for the Master API. If you want to use it with Spring, consider using the Spring Boot API client.

Dependency declaration

To declare a dependency to this client, use the following syntax.

Maven users

Add this dependency to your project’s POM:

<dependency>
  <groupId>com.decisionbrain</groupId>
  <artifactId>optimserver-api-client</artifactId>
  <version>3.3.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project’s build file:

compile "com.decisionbrain:optimserver-api-client:3.3.0"

Usage

The client Javadoc is available in this page .

public class SampleJavaSSEClient {

    private static JobApi createJobApi() {

        HttpHeadersProvider keycloakHeaders = new KeycloakHttpHeadersProvider(
                KEYCLOAK_URL,
                KEYCLOAK_REALM,
                KEYCLOAK_CLIENT,
                KEYCLOAK_USER,
                KEYCLOAK_PASSWORD
        );

        ApiClientConfiguration apiConf = ApiClientConfiguration.builder()
                .baseUri(new URI("http://" + DBOS_MASTER_HOST + ":" + DBOS_MASTER_PORT).normalize())
                .requestHeaders(keycloakHeaders)
                .build();

        return new JobApi(new ApiClient(apiConf));
    }
}