Class RestApiQueryCall<K,V>
- java.lang.Object
-
- io.streamthoughts.azkarra.api.query.DecorateQuery<QueryRequest>
-
- io.streamthoughts.azkarra.http.query.RestApiQueryCall<K,V>
-
- Type Parameters:
K
- the expected type for the record key.V
- the expected type for the record value.
public class RestApiQueryCall<K,V> extends DecorateQuery<QueryRequest> implements QueryCall<K,V>
ARestApiQueryCall
can be used to execute an interactive query on a remote instance.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.streamthoughts.azkarra.api.query.QueryCall
QueryCall.QueryCallFactory
-
-
Field Summary
-
Fields inherited from class io.streamthoughts.azkarra.api.query.DecorateQuery
query
-
-
Constructor Summary
Constructors Constructor Description RestApiQueryCall(String applicationId, Endpoint localEndpoint, Endpoint remoteEndpoint, AzkarraV1Api api, QueryRequest request)
Creates a newRestApiQueryCall
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Cancels theQueryCall
, if possible.QueryResult<K,V>
execute(QueryOptions options)
Executes thisQueryCall
.CompletableFuture<QueryResult<K,V>>
executeAsync(QueryOptions options)
Executes thisQueryCall
asynchronously.void
executeAsync(QueryOptions options, Consumer<QueryResult<K,V>> resultCallback)
Executes thisQueryCall
asynchronously.boolean
isCanceled()
boolean
isExecuted()
QueryCall<K,V>
renew()
Create a new, identicalQueryCall
to this one which can be re-executed even if this call has already been.-
Methods inherited from class io.streamthoughts.azkarra.api.query.DecorateQuery
equals, getParams, getStoreName, getStoreOperation, getStoreType, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.streamthoughts.azkarra.api.query.Query
getParams, getStoreName, getStoreOperation, getStoreType
-
-
-
-
Constructor Detail
-
RestApiQueryCall
public RestApiQueryCall(String applicationId, Endpoint localEndpoint, Endpoint remoteEndpoint, AzkarraV1Api api, QueryRequest request)
Creates a newRestApiQueryCall
instance.- Parameters:
applicationId
- theapplication.id
.localEndpoint
- the localEndpoint
from which this remote query is executed.remoteEndpoint
- the remoteEndpoint
to query.api
- theAzkarraV1Api
.request
- theQueryRequest
to execute.
-
-
Method Detail
-
execute
public QueryResult<K,V> execute(QueryOptions options)
Executes thisQueryCall
.- Specified by:
execute
in interfaceQueryCall<K,V>
- Parameters:
options
- the options to be used.- Returns:
- the
QueryResult
.
-
executeAsync
public CompletableFuture<QueryResult<K,V>> executeAsync(QueryOptions options)
Executes thisQueryCall
asynchronously.- Specified by:
executeAsync
in interfaceQueryCall<K,V>
- Parameters:
options
- the options to be used.- Returns:
- a
CompletableFuture
ofQueryResult
.
-
executeAsync
public void executeAsync(QueryOptions options, Consumer<QueryResult<K,V>> resultCallback)
Executes thisQueryCall
asynchronously.- Specified by:
executeAsync
in interfaceQueryCall<K,V>
- Parameters:
options
- the options to be used.resultCallback
- the callback to be invoked when thisQueryCall
complete with either a success result or a failure exception.
-
isExecuted
public boolean isExecuted()
- Specified by:
isExecuted
in interfaceQueryCall<K,V>
- Returns:
true
if thisQueryCall
has already been executed.
-
isCanceled
public boolean isCanceled()
- Specified by:
isCanceled
in interfaceQueryCall<K,V>
- Returns:
true
if thisQueryCall
has already been canceled.
-
-