Package com.cognite.client.servicesV1
Class ConnectorServiceV1.AsyncJobReader<T>
- java.lang.Object
-
- com.cognite.client.servicesV1.ConnectorServiceV1.ConnectorBase
-
- com.cognite.client.servicesV1.ConnectorServiceV1.AsyncJobReader<T>
-
- All Implemented Interfaces:
Connector<T>,ItemReader<T>,Serializable
- Enclosing class:
- ConnectorServiceV1
public abstract static class ConnectorServiceV1.AsyncJobReader<T> extends ConnectorServiceV1.ConnectorBase implements Connector<T>, ItemReader<T>
Reads items from the Cognite API. This reader targets API endpoints which complete its operation over two requests. I.e. async api pattern where the first request starts the job and the second request collects the result. The reader works in two steps: 1. Issue a "start job" request. 2. Start a polling loop issuing "get job results/status" requests. The "start job" step is executed using the inputRequest, the configuredRequestProvider"jobStartRequestProvider" and the configuredJobStartResponseParser. This request will typically yield a response which contains the async job identification parameters (jobId,modelId, etc.). These identification parameters are again used as input for step 2, "get job results". The output from step 1 is aRequestobject representing the parameters to be used as input to step 2, "get job results/update". TheRequestis interpreted by theJobResultRequestProviderand the api will regularly be polled for job results. When the api provides job results, this response is routed to theResponseParserand returned.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AsyncJobReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResponseItems<T>execute(Request items)Executes a request to get items and blocks the thread until all items have been downloaded.CompletableFuture<ResponseItems<T>>executeAsync(Request items)Executes an item-based request to get items asynchronously.ResponseItems<T>getItems(Request items)Executes a request to get items and blocks the thread until all items have been downloaded.CompletableFuture<ResponseItems<T>>getItemsAsync(Request items)Executes an item-based request to get items asynchronously.
-
-
-
Method Detail
-
execute
public ResponseItems<T> execute(Request items) throws Exception
Executes a request to get items and blocks the thread until all items have been downloaded.
-
executeAsync
public CompletableFuture<ResponseItems<T>> executeAsync(Request items) throws Exception
Executes an item-based request to get items asynchronously.- Specified by:
executeAsyncin interfaceConnector<T>- Parameters:
items-- Returns:
- Throws:
Exception
-
getItems
public ResponseItems<T> getItems(Request items) throws Exception
Executes a request to get items and blocks the thread until all items have been downloaded.- Specified by:
getItemsin interfaceItemReader<T>- Parameters:
items-- Returns:
- Throws:
Exception
-
getItemsAsync
public CompletableFuture<ResponseItems<T>> getItemsAsync(Request items) throws Exception
Executes an item-based request to get items asynchronously.- Specified by:
getItemsAsyncin interfaceItemReader<T>- Parameters:
items-- Returns:
- Throws:
Exception
-
-