Class FeedClientImpl
- java.lang.Object
-
- com.yahoo.vespa.http.client.core.api.FeedClientImpl
-
- All Implemented Interfaces:
FeedClient
,AutoCloseable
public class FeedClientImpl extends Object implements FeedClient
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
Constructors Constructor Description FeedClientImpl(SessionParams sessionParams, FeedClient.ResultCallback resultCallback, ScheduledThreadPoolExecutor timeoutExecutor, Clock clock)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Waits for all results to arrive and closes the FeedClient.String
getStatsAsJson()
Returns stats about the clustervoid
stream(String documentId, String operationId, CharSequence documentData, Object context)
Issues a document operation to the configured cluster(s).static boolean
waitForOperations(Instant lastResultReceived, long sleepTimeMs, long closeTimeoutMs)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.yahoo.vespa.http.client.FeedClient
stream, stream
-
-
-
-
Constructor Detail
-
FeedClientImpl
public FeedClientImpl(SessionParams sessionParams, FeedClient.ResultCallback resultCallback, ScheduledThreadPoolExecutor timeoutExecutor, Clock clock)
-
-
Method Detail
-
stream
public void stream(String documentId, String operationId, CharSequence documentData, Object context)
Description copied from interface:FeedClient
Issues 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:
stream
in 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:FeedClient
Waits 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceFeedClient
-
getStatsAsJson
public String getStatsAsJson()
Description copied from interface:FeedClient
Returns stats about the cluster- Specified by:
getStatsAsJson
in interfaceFeedClient
- Returns:
- JSON string with information about cluster
-
waitForOperations
public static boolean waitForOperations(Instant lastResultReceived, long sleepTimeMs, long closeTimeoutMs)
-
-