Interface FeedClient

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
FeedClientImpl

@Deprecated public interface FeedClient extends AutoCloseable
Deprecated.
Vespa-http-client will be removed in Vespa 8. It's replaced by vespa-feed-client
API for feeding document operations (add, removes or updates) to one or many Vespa clusters. Use the factory to configure and set up an instance of this. Instances are expensive - create one instance of this and use it for all feed operations (from multiple threads, if desired) for the duration of your client runtime. The feedclient does automatic error recovery and reconnects to hosts when connections die. A FeedClientFactory is provided to instantiate Sessions. See com.yahoo.text.Text.stripInvalidCharacters(String) to remove invalid characters from string fields before feeding Instances of this are multithread safe.
Author:
dybis
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Deprecated.
    This callback is executed when new results are arriving or an error occur.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
    Waits for all results to arrive and closes the FeedClient.
    static void
    feedJson(InputStream inputStream, FeedClient feedClient, AtomicInteger numSent)
    Deprecated.
    Utility function that takes an array of JSON documents and calls the FeedClient for each element.
    static void
    feedXml(InputStream inputStream, FeedClient feedClient, AtomicInteger numSent)
    Deprecated.
    Utility function that takes an array of XML documents and calls the FeedClient for each element.
    Deprecated.
    Returns stats about the cluster
    default void
    stream(String documentId, CharSequence documentData)
    Deprecated.
    Issues a document operation to the configured cluster(s).
    default void
    stream(String documentId, CharSequence documentData, Object context)
    Deprecated.
    Issues a document operation to the configured cluster(s).
    void
    stream(String documentId, String operationId, CharSequence documentData, Object context)
    Deprecated.
    Issues a document operation to the configured cluster(s).
  • Method Details

    • stream

      default void stream(String documentId, CharSequence documentData)
      Deprecated.
      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 failured are retried internally by this client. Exactly one callback will always be received for each (completed) call to this.
      Parameters:
      documentId - the document id of the document
      documentData - the document data as JSON or XML (as specified when using the factory to create the API)
    • stream

      default void stream(String documentId, CharSequence documentData, Object context)
      Deprecated.
      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 failured are retried internally by this client. Exactly one callback will always be received for each (completed) call to this.
      Parameters:
      documentId - the document id of the document
      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
    • stream

      void stream(String documentId, String operationId, CharSequence documentData, Object context)
      Deprecated.
      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.
      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

      void close()
      Deprecated.
      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
    • getStatsAsJson

      String getStatsAsJson()
      Deprecated.
      Returns stats about the cluster
      Returns:
      JSON string with information about cluster
    • feedJson

      static void feedJson(InputStream inputStream, FeedClient feedClient, AtomicInteger numSent)
      Deprecated.
      Utility function that takes an array of JSON documents and calls the FeedClient for each element.
      Parameters:
      inputStream - the stream to feed. This can be a very large stream. The outer element must be an array of document operations.
      feedClient - the feed client that will receive the document operations
      numSent - increased per document sent to API (but not waiting for results)
    • feedXml

      static void feedXml(InputStream inputStream, FeedClient feedClient, AtomicInteger numSent)
      Deprecated.
      Utility function that takes an array of XML documents and calls the FeedClient for each element. The XML document has to be formatted with line space on each line (like "regular" XML, but stricter than the specifications of XML).
      Parameters:
      inputStream - the stream to feed. This can be a very large stream. Operations must be enclosed in a top-level <vespafeed> tag
      feedClient - the feed client that will receive the document operations
      numSent - increased per document sent to API (but not waiting for results)