2. ArmoniK Java SDK — Client
2.1. Role of the Client SDK
The client SDK provides a language-friendly interface to interact with ArmoniK’s control plane. It allows you to:
Create and manage sessions.
Define and submit tasks, optionally with dependencies.
Create and manage input and output blobs.
Monitor task progress and retrieve results.
Use optional asynchronous callback mechanisms.
Ensure consistent workflow semantics: retries, error propagation, idempotency.
2.2. Entry Point: ArmoniKClient
The main entry point is ArmoniKClient, configured via ArmoniKConfig which describes:
Endpoints
TLS configuration
Retry policy
Use try-with-resources for automatic cleanup:
try (ArmoniKClient client = new ArmoniKClient(config)) {
// ...
}
Available operations on ArmoniKClient:
Create a new
SessionRetrieve an existing
SessionCancel a
SessionClose a
Session
2.3. Session Creation
Define a session with SessionDefinition, then submit it to get a SessionHandle.
SessionDefinition components:
Component |
Description |
|---|---|
Partition IDs |
Where tasks can execute |
|
Default configuration for all tasks |
|
Callback when an output blob is |
2.4. Blob Completion Listener
BlobCompletionListener is a callback interface for async result notifications. Register it in SessionDefinition to enable event-driven result handling.
BlobCompletionListener listener = new BlobCompletionListener() {
@Override
public void onBlobSuccess(Blob blob) { /* blob is ready */ }
@Override
public void onBlobError(BlobError error) { /* handle error */ }
};
2.5. Working with Blobs
Type |
Description |
|---|---|
|
Data sent to workers |
|
Placeholder for expected results |
|
Reference to an already uploaded/downloaded blob |
Input data can come from:
In-memory byte array
File
Custom source by implementing the
BlobDatainterface
SessionHandle can also create session-scoped blobs directly.
2.6. Task Submission
Create a TaskDefinition specifying:
Inputs:
InputBlobDefinitionorBlobHandleOutputs:
OutputBlobDefinitionOptional: override
TaskConfigurationOptional:
WorkerLibraryfor dynamic loading
Submit it to SessionHandle. This is non-blocking and returns a TaskHandle immediately.
2.7. WorkerLibrary (Dynamic Loading)
WorkerLibrary describes a dynamically loaded worker library for task execution. It has three components:
Field |
Description |
Example |
|---|---|---|
|
Path to the artifact inside the zip |
|
|
Fully qualified class name |
|
|
|
— |
2.8. Typical Workflow
1. Create ArmoniKClient with config
2. Create SessionDefinition (with partitions, TaskConfiguration, listener)
3. Open SessionHandle
4. Define InputBlobDefinition and OutputBlobDefinition
5. Create and submit TaskDefinition
6. Wait for completion or react to BlobCompletionListener callbacks
7. Read output blobs
8. Close session and client
2.9. Task Submission Flow (General)
The client creates a session to group related tasks.
Input data is uploaded as blobs.
The client defines one or more task definitions, each referencing:
input blobs (data dependencies)
expected output blobs
optional task configuration
Tasks are submitted to the control plane.
Workers execute tasks, read inputs, and produce outputs.
The control plane signals task completion.
The client retrieves output blobs or submits new tasks to continue the workflow.