Package ai.vespa.feed.client
Interface FeedClient
-
- All Superinterfaces:
AutoCloseable
,Closeable
public interface FeedClient extends Closeable
Asynchronous feed client accepting document operations as JSON. The payload should be the same as the HTTP payload required by the /document/v1 HTTP API, i.e.,{ "fields": { ... } }
- Author:
- bjorncs, jonmv
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
FeedClient.CircuitBreaker
Allows slowing down or halting completely operations against the configured endpoint on high failure rates.static class
FeedClient.OperationType
static interface
FeedClient.RetryStrategy
Controls what to retry, and how many times.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static List<Result>
await(CompletableFuture<Result>... promises)
Same asawait(List)
exceptpromises
parameter is a varargstatic List<Result>
await(List<CompletableFuture<Result>> promises)
Waits for all feed operations to complete, either successfully or with exception.FeedClient.CircuitBreaker.State
circuitBreakerState()
Current state of the circuit breaker.default void
close()
Initiates graceful shutdown.void
close(boolean graceful)
Shut down, and reject new operations.CompletableFuture<Result>
put(DocumentId documentId, String documentJson, OperationParameters params)
Send a document put with the given parameters, returning a future with the result of the operation.CompletableFuture<Result>
remove(DocumentId documentId, OperationParameters params)
Send a document remove with the given parameters, returning a future with the result of the operation.OperationStats
stats()
Returns a snapshot of the stats for this feed client, such as requests made, and responses by status.CompletableFuture<Result>
update(DocumentId documentId, String updateJson, OperationParameters params)
Send a document update with the given parameters, returning a future with the result of the operation.
-
-
-
Method Detail
-
put
CompletableFuture<Result> put(DocumentId documentId, String documentJson, OperationParameters params)
Send a document put with the given parameters, returning a future with the result of the operation. Exceptional completion will use be an instance ofFeedException
or one of its sub-classes.
-
update
CompletableFuture<Result> update(DocumentId documentId, String updateJson, OperationParameters params)
Send a document update with the given parameters, returning a future with the result of the operation. Exceptional completion will use be an instance ofFeedException
or one of its sub-classes.
-
remove
CompletableFuture<Result> remove(DocumentId documentId, OperationParameters params)
Send a document remove with the given parameters, returning a future with the result of the operation. Exceptional completion will use be an instance ofFeedException
or one of its sub-classes.
-
await
static List<Result> await(List<CompletableFuture<Result>> promises) throws MultiFeedException
Waits for all feed operations to complete, either successfully or with exception.- Returns:
- list of results with the same ordering as the
promises
parameter - Throws:
MultiFeedException
- if any operation fails
-
await
@SafeVarargs static List<Result> await(CompletableFuture<Result>... promises) throws MultiFeedException
Same asawait(List)
exceptpromises
parameter is a vararg- Throws:
MultiFeedException
- See Also:
await(List)
-
stats
OperationStats stats()
Returns a snapshot of the stats for this feed client, such as requests made, and responses by status.
-
circuitBreakerState
FeedClient.CircuitBreaker.State circuitBreakerState()
Current state of the circuit breaker.
-
close
void close(boolean graceful)
Shut down, and reject new operations. Operations in flight are allowed to complete normally if graceful.
-
close
default void close()
Initiates graceful shutdown. Seeclose(boolean)
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-