InfiniticClient class is the main entry point for interacting with Infinitic from your application. It allows you to start workflows, retrieve workflow instances, manage workflow execution, and complete delegated tasks.
Package
Constructor
The client configuration including transport settings
Creation Methods
TheInfiniticClient provides several static factory methods for creating instances:
From Builder
From YAML
Creates a client from YAML files in the resources directoryParameters:
resources: String...- Resource paths
Creates a client from YAML files in the file systemParameters:
files: String...- File paths
Creates a client from YAML stringsParameters:
yamls: String...- YAML content strings
Instance Methods
Workflow Management
Creates a stub for starting a new workflow instanceParameters:
klass: Class<out T>- The workflow interface classtags: Set<String>?- Optional tags for the workflow (default: null)meta: Map<String, ByteArray>?- Optional metadata (default: null)
Gets a stub for an existing workflow by IDParameters:
klass: Class<out T>- The workflow interface classid: String- The workflow instance ID
Gets a stub for existing workflows by tagParameters:
klass: Class<out T>- The workflow interface classtag: String- The workflow tag
Starting Workflows
Starts a workflow method asynchronouslyParameters:
invoke: () -> R- Lambda invoking the workflow method
Starts a void workflow method asynchronouslyParameters:
invoke: () -> Unit- Lambda invoking the workflow method
Deferred<Void>Workflow Control
Cancels a running workflowParameters:
stub: Any- The workflow stub (must be from getWorkflowById or getWorkflowByTag)
Retries the current workflow taskParameters:
stub: Any- The workflow stub
Retries tasks within a workflowOverloads:
retryTasksAsync(stub: Any, taskId: String)- Retry specific task by IDretryTasksAsync(stub: Any, taskStatus: DeferredStatus?, taskClass: Class<*>?)- Retry tasks by status and/or class
stub: Any- The workflow stubtaskId: String- The task ID to retrytaskStatus: DeferredStatus?- Filter by task status (FAILED, CANCELED, etc.)taskClass: Class<*>?- Filter by task class
Manually completes timers within a workflowParameters:
stub: Any- The workflow stubid: String?- Optional workflow method ID to target specific timers
Delegated Tasks
Completes a delegated task from an external systemParameters:
serviceName: String- The service nametaskId: String- The task ID (from Task.taskId)result: Any?- The task result
Query Methods
Gets all workflow IDs associated with a tagParameters:
stub: T- The workflow stub (must be from getWorkflowByTag)
Properties
Gets the last Deferred created by calling a stub methodExample:
Gets the client name (used for message routing)
Lifecycle
Closes the client and releases resourcesExample:
Usage Example
Thread Safety
TheInfiniticClient is thread-safe and can be shared across multiple threads. Itβs recommended to create a single instance and reuse it throughout your application.
See Also
- Client Configuration - For configuration options
- Deferred - For handling asynchronous results
- Workflow - For workflow implementation