Package com.cognite.client.servicesV1
Class ResponseBinary
java.lang.Object
com.cognite.client.servicesV1.ResponseBinary
- All Implemented Interfaces:
Serializable
This is a helper class for transporting a http response. We cannot use the
okhttp3.Response object
as its main payload can only be consumed once and must be closed as soon as possible to prevent holding on to
connection resources.
This class will hold both the binary response payload as well as its metadata.- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract LongReturns the measured job duration of an async api request.abstract LongReturns the measured queue duration of an async api request.abstract LongReturns the measured latency in getting the first response from the api.abstract intabstract okhttp3.ResponseReturns the originalResponse(less the body) with metadata and header values.abstract com.google.protobuf.ByteStringReturns the main body of the response.static ResponseBinaryof(okhttp3.Response response, com.google.protobuf.ByteString body) withApiJobDuration(long millies) Set the api job duration (in milliseconds) associated with this response.withApiJobQueueDuration(long millies) Set the api job queue duration (in milliseconds) associated with this response.withApiLatency(long latency) withApiRetryCounter(int count)
-
Constructor Details
-
ResponseBinary
public ResponseBinary()
-
-
Method Details
-
of
-
getResponse
public abstract okhttp3.Response getResponse()Returns the originalResponse(less the body) with metadata and header values.- Returns:
- The response metadata
-
getResponseBodyBytes
public abstract com.google.protobuf.ByteString getResponseBodyBytes()Returns the main body of the response.- Returns:
- The main body of the response.
-
getApiRetryCounter
public abstract int getApiRetryCounter() -
getApiLatency
Returns the measured latency in getting the first response from the api. The latency is calculated by measuring the duration between sending the request to the api and receiving (but not processing) the response.- Returns:
- The measured api latency in milliseconds for producing this response.
-
getApiJobQueueDurationMillies
Returns the measured queue duration of an async api request. These requests typically represent potentially long-running jobs like contextualization tasks (entity matching, P&ID parsing, etc.). Async api requests first enter a job queue before they are processed by a worker. If the queue duration grows over time, it is a sign that the api is unable to scale up to meet the request demand.- Returns:
- The job queue duration in milliseconds.
-
getApiJobDurationMillies
Returns the measured job duration of an async api request. These requests typically represent potentially long-running jobs like contextualization tasks (entity matching, P&ID parsing, etc.).- Returns:
- The job duration in milliseconds.
-
withApiRetryCounter
-
withApiLatency
-
withApiJobQueueDuration
Set the api job queue duration (in milliseconds) associated with this response. Only applicable for async api calls.- Parameters:
millies- the api queue duration in milliseconds.- Returns:
- The ResponseBinary with the queue duration.
-
withApiJobDuration
Set the api job duration (in milliseconds) associated with this response. Only applicable for async api calls.- Parameters:
millies- the api job duration in milliseconds.- Returns:
- The ResponseBinary with the job duration.
-