Jersey SSE (Async)

Overview

This client is the SSE implementation of the job execution asynchronous API described here.

Maven users

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

Gradle users

implementation "com.decisionbrain:com.decisionbrain:optimserver-sse-client:3.3.0"

Usage

public class SampleJavaSSEClient {

    private static JobExecutionAsyncApi createSseAsyncApi() {

        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 SseJobExecutionAsyncImpl(
                new SseEventSourceFactory(apiConf)
        );
    }
}