Class FeedClientImpl
java.lang.Object
com.yahoo.vespa.http.client.core.api.FeedClientImpl
- All Implemented Interfaces:
FeedClient,AutoCloseable
Implementation of FeedClient. It is a thin layer on top of multiClusterHandler and multiClusterResultAggregator.
- Author:
- dybis
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.yahoo.vespa.http.client.FeedClient
FeedClient.ResultCallback -
Constructor Summary
ConstructorsConstructorDescriptionFeedClientImpl(SessionParams sessionParams, FeedClient.ResultCallback resultCallback, ScheduledThreadPoolExecutor timeoutExecutor, Clock clock) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Waits for all results to arrive and closes the FeedClient.Returns stats about the clustervoidstream(String documentId, String operationId, CharSequence documentData, Object context) Issues a document operation to the configured cluster(s).static booleanwaitForOperations(Instant lastResultReceived, long sleepTimeMs, long closeTimeoutMs) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.yahoo.vespa.http.client.FeedClient
stream, stream
-
Constructor Details
-
FeedClientImpl
public FeedClientImpl(SessionParams sessionParams, FeedClient.ResultCallback resultCallback, ScheduledThreadPoolExecutor timeoutExecutor, Clock clock)
-
-
Method Details
-
stream
public void stream(String documentId, String operationId, CharSequence documentData, Object context) Description copied from interface:FeedClientIssues a document operation to the configured cluster(s). If the pipeline and buffers are full, this call will be blocking, ensuring that operations are not produced faster than the can be handled. Transient failures are retried internally by this client. Exactly one callback will always be received for each (completed) call to this.- Specified by:
streamin interfaceFeedClient- Parameters:
documentId- the document id of the documentoperationId- the id to use for this operation, or null to let the client decide an operation id. This id must be unique for every operation. Passing the operation id allows clients to prepare to receive a response for it before issuing the operation to the client.documentData- the document data as JSON or XML (as specified when using the factory to create the API)context- a context object which will be accessible in the result of the callback, or null if none
-
close
public void close()Description copied from interface:FeedClientWaits for all results to arrive and closes the FeedClient. Don't call any other method after calling close(). Does not throw any exceptions.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceFeedClient
-
getStatsAsJson
Description copied from interface:FeedClientReturns stats about the cluster- Specified by:
getStatsAsJsonin interfaceFeedClient- Returns:
- JSON string with information about cluster
-
waitForOperations
public static boolean waitForOperations(Instant lastResultReceived, long sleepTimeMs, long closeTimeoutMs)
-