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 input
Request, the configured
RequestProvider "jobStartRequestProvider" and the configured JobStartResponseParser.
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 a Request object representing the parameters to be used
as input to step 2, "get job results/update". The Request is interpreted by the
JobResultRequestProvider and the api will regularly be polled for job results. When the api provides
job results, this response is routed to the ResponseParser and returned.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExecutes a request to get items and blocks the thread until all items have been downloaded.executeAsync(Request items) Executes an item-based request to get items asynchronously.Executes a request to get items and blocks the thread until all items have been downloaded.getItemsAsync(Request items) Executes an item-based request to get items asynchronously.
-
Constructor Details
-
AsyncJobReader
public AsyncJobReader()
-
-
Method Details
-
execute
Executes a request to get items and blocks the thread until all items have been downloaded. -
executeAsync
Executes an item-based request to get items asynchronously.- Specified by:
executeAsyncin interfaceConnector<T>- Parameters:
items-- Returns:
- Throws:
Exception
-
getItems
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
Executes an item-based request to get items asynchronously.- Specified by:
getItemsAsyncin interfaceItemReader<T>- Parameters:
items-- Returns:
- Throws:
Exception
-