Class AsyncQueryApiCallback<K,V>
- java.lang.Object
-
- io.streamthoughts.azkarra.http.query.AsyncQueryApiCallback<K,V>
-
- All Implemented Interfaces:
ApiCallback<V1QueryResult>
public class AsyncQueryApiCallback<K,V> extends Object implements ApiCallback<V1QueryResult>
-
-
Constructor Summary
Constructors Constructor Description AsyncQueryApiCallback(CompletableFuture<QueryResult<K,V>> completableFuture, ApiOnFailureCallback onFailureCallback)
Creates a newAsyncQueryApiCallback
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onDownloadProgress(long bytesRead, long contentLength, boolean done)
This is called when the API downlond processing.void
onFailure(ApiException e, int statusCode, Map responseHeaders)
This is called when the API call fails.void
onSuccess(V1QueryResult result, int statusCode, Map<String,List<String>> responseHeaders)
This is called when the API call succeeded.void
onUploadProgress(long bytesWritten, long contentLength, boolean done)
This is called when the API upload processing.
-
-
-
Constructor Detail
-
AsyncQueryApiCallback
public AsyncQueryApiCallback(CompletableFuture<QueryResult<K,V>> completableFuture, ApiOnFailureCallback onFailureCallback)
Creates a newAsyncQueryApiCallback
instance.- Parameters:
completableFuture
- theCompletableFuture
instance.
-
-
Method Detail
-
onFailure
public void onFailure(ApiException e, int statusCode, Map responseHeaders)
This is called when the API call fails.- Specified by:
onFailure
in interfaceApiCallback<K>
- Parameters:
e
- The exception causing the failurestatusCode
- Status code of the response if available, otherwise it would be 0responseHeaders
- Headers of the response if available, otherwise it would be null
-
onSuccess
public void onSuccess(V1QueryResult result, int statusCode, Map<String,List<String>> responseHeaders)
This is called when the API call succeeded.- Specified by:
onSuccess
in interfaceApiCallback<K>
- Parameters:
result
- The result deserialized from responsestatusCode
- Status code of the responseresponseHeaders
- Headers of the response
-
onUploadProgress
public void onUploadProgress(long bytesWritten, long contentLength, boolean done)
Description copied from interface:ApiCallback
This is called when the API upload processing.- Specified by:
onUploadProgress
in interfaceApiCallback<K>
- Parameters:
bytesWritten
- bytes WrittencontentLength
- content length of request bodydone
- write end
-
onDownloadProgress
public void onDownloadProgress(long bytesRead, long contentLength, boolean done)
Description copied from interface:ApiCallback
This is called when the API downlond processing.- Specified by:
onDownloadProgress
in interfaceApiCallback<K>
- Parameters:
bytesRead
- bytes ReadcontentLength
- content lenngth of the responsedone
- Read end
-
-