Class SimpleLoggerResultCallback

  • All Implemented Interfaces:
    FeedClient.ResultCallback

    public class SimpleLoggerResultCallback
    extends java.lang.Object
    implements FeedClient.ResultCallback
    Simple implementation of the ResultCallback that logs to std err for every X documents: "Result received: 34 (1 failed so far, 2003 sent, success rate 1999.23 docs/sec)." On each failure it will print the Result object content. If tracing is enabled, it will print trace messages to std err as well.
    Author:
    dybis
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleLoggerResultCallback​(java.util.concurrent.atomic.AtomicInteger sentDocumentCounter, int printStatsForEveryXDocument)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected com.yahoo.vespa.http.client.SimpleLoggerResultCallback.DocumentRate newSamplingPeriod​(java.time.Instant now)  
      void onCompletion​(java.lang.String docId, Result documentResult)
      This callback is always called exactly once for each feed operation passed to the client instance, whether or not it was successful.
      protected void println​(java.lang.String output)  
      void printProgress()
      Prints how many documents that are received, failed and sent.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleLoggerResultCallback

        public SimpleLoggerResultCallback​(java.util.concurrent.atomic.AtomicInteger sentDocumentCounter,
                                          int printStatsForEveryXDocument)
        Constructor
        Parameters:
        sentDocumentCounter - a counter that is increased outside this class, but can be nice to print here.
        printStatsForEveryXDocument - how often to print stats.
    • Method Detail

      • println

        protected void println​(java.lang.String output)
      • printProgress

        public void printProgress()
        Prints how many documents that are received, failed and sent.
      • newSamplingPeriod

        protected com.yahoo.vespa.http.client.SimpleLoggerResultCallback.DocumentRate newSamplingPeriod​(java.time.Instant now)
      • onCompletion

        public void onCompletion​(java.lang.String docId,
                                 Result documentResult)
        Description copied from interface: FeedClient.ResultCallback
        This callback is always called exactly once for each feed operation passed to the client instance, whether or not it was successful.
        Specified by:
        onCompletion in interface FeedClient.ResultCallback