java.lang.Object
ai.docling.serve.client.operations.AsyncOperations
- Direct Known Subclasses:
ChunkOperations,ConvertOperations
Abstract base class for managing asynchronous operations, providing methods to execute
tasks asynchronously and poll for their status until completion. Subclasses must implement
specific logic for retrieving task results.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAsyncOperations(HttpOperations httpOperations, ai.docling.serve.api.DoclingServeTaskApi taskApi, Duration asyncPollInterval, Duration asyncTimeout) -
Method Summary
Modifier and TypeMethodDescriptionprotected <I,O> CompletionStage<O> executeAsync(I request, String uri) Executes an asynchronous operation by sending a request to the specified URI and polling for the task completion.protected abstract <O> OgetTaskResult(ai.docling.serve.api.task.request.TaskResultRequest taskResultRequest) Retrieves the result of a task based on the provided task result request.
-
Constructor Details
-
AsyncOperations
protected AsyncOperations(HttpOperations httpOperations, ai.docling.serve.api.DoclingServeTaskApi taskApi, Duration asyncPollInterval, Duration asyncTimeout)
-
-
Method Details
-
getTaskResult
protected abstract <O> O getTaskResult(ai.docling.serve.api.task.request.TaskResultRequest taskResultRequest) Retrieves the result of a task based on the provided task result request. This method is abstract and meant to be implemented by subclasses. It uses the information provided in theTaskResultRequestto obtain the result of the task execution.- Type Parameters:
O- the type of the result object returned- Parameters:
taskResultRequest- the request containing the details, including the task ID, required to retrieve the task result- Returns:
- the result of the task execution, of the type
O
-
executeAsync
Executes an asynchronous operation by sending a request to the specified URI and polling for the task completion. This method uses an HTTP POST operation to start the task and then repeatedly polls the task status to determine when the operation is complete.- Type Parameters:
I- the type of the request object being sentO- the type of the response object returned upon completion- Parameters:
request- the request object containing the data necessary to initialize the taskuri- the endpoint URI to which the request will be sent- Returns:
- a
CompletionStagethat will be completed with the result of the asynchronous operation
-