AddonClientFactory

@PublicApi
public final class AddonClientFactory



Provides a AddonClient.

Summary

Public methods

static AddonClient
getClient(long cloudProjectNumber)

Returns the singleton instance of AddonClient.

static AddonClient
getClient(
    long cloudProjectNumber,
    Optional<ExecutorService> backgroundExecutorService,
    Optional<ScheduledExecutorService> scheduledExecutorService
)

Returns the singleton instance of AddonClient.

Public methods

getClient

public static AddonClient getClient(long cloudProjectNumber)

Returns the singleton instance of AddonClient.

Parameters
long cloudProjectNumber

the cloud project number of the Google Workspace Marketplace add-on associated with the app

Throws
java.lang.IllegalArgumentException

if the cloudProjectNumber changes across calls

getClient

public static AddonClient getClient(
    long cloudProjectNumber,
    Optional<ExecutorService> backgroundExecutorService,
    Optional<ScheduledExecutorService> scheduledExecutorService
)

Returns the singleton instance of AddonClient.

Passing in different values backgroundExecutorService or scheduledExecutorService across multiple calls is not recommended and has no effect.

If empty optionals are provided for the ExecutorService or ScheduledExecutorService the SDK will create its own in their place for background tasks.

Parameters
long cloudProjectNumber

the cloud project number of the Google Workspace Marketplace add-on associated with the add-on app

Optional<ExecutorService> backgroundExecutorService

an executor for the SDK to offload various internal tasks including IPC, callbacks etc. The executor should have a thread pool of size 6 or more for optimal performance. Using a single-threaded ExecutorService will lead to poor performance.

Optional<ScheduledExecutorService> scheduledExecutorService

a ScheduledExecutorService for the SDK to perform periodic tasks for state synchronization. This can have a single thread without affecting performance.

Throws
java.lang.IllegalArgumentException

if the cloudProjectNumber is not provided or changes across calls