Package ai.vespa.feed.client
Interface FeedClient
- All Superinterfaces:
AutoCloseable
,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
Modifier and TypeInterfaceDescriptionstatic interface
Allows slowing down or halting completely operations against the configured endpoint on high failure rates.static enum
static interface
Controls what to retry, and how many times. -
Method Summary
Modifier and TypeMethodDescriptionawait
(CompletableFuture<Result>... promises) Same asawait(List)
exceptpromises
parameter is a varargawait
(List<CompletableFuture<Result>> promises) Waits for all feed operations to complete, either successfully or with exception.Current state of the circuit breaker.default void
close()
Initiates graceful shutdown.void
close
(boolean graceful) Shut down, and reject new operations.put
(DocumentId documentId, String documentJson, OperationParameters params) Send a document put with the given parameters, returning a future with the result of the operation.remove
(DocumentId documentId, OperationParameters params) Send a document remove with the given parameters, returning a future with the result of the operation.stats()
Returns a snapshot of the stats for this feed client, such as requests made, and responses by status.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 Details
-
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
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
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:
-
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
-