Class 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
    • 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 interface FeedClient
        Parameters:
        documentId - the document id of the document
        operationId - 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 interface AutoCloseable
        Specified by:
        close in interface FeedClient
      • getStatsAsJson

        public String getStatsAsJson()
        Description copied from interface: FeedClient
        Returns stats about the cluster
        Specified by:
        getStatsAsJson in interface FeedClient
        Returns:
        JSON string with information about cluster
      • waitForOperations

        public static boolean waitForOperations​(Instant lastResultReceived,
                                                long sleepTimeMs,
                                                long closeTimeoutMs)