org.apache.solr.morphlines.solr

## Class SolrClientDocumentLoader

- java.lang.Object
- - org.apache.solr.morphlines.solr.SolrClientDocumentLoader

- All Implemented Interfaces:
    DocumentLoader

      public class SolrClientDocumentLoader
      extends Object
      implements DocumentLoader

  A vehicle to load a list of Solr documents into a local or remote `SolrClient`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SolrClientDocumentLoader(SolrClient client, int batchSize)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beginTransaction()` Begins a transaction
    `void` | `commitTransaction()` Sends any outstanding documents to the destination and waits for a positive or negative ack (i.e.
    `SolrClient` | `getSolrClient()`
    `void` | `load(SolrInputDocument doc)` Loads the given document into the destination
    `SolrPingResponse` | `ping()` Issues a ping request to check if the server is alive
    `UpdateResponse` | `rollbackTransaction()` Performs a rollback of all non-committed documents pending.
    `void` | `shutdown()` Releases allocated resources

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SolrClientDocumentLoader

          public SolrClientDocumentLoader(SolrClient client,
                                          int batchSize)

  - ### Method Detail

    - #### beginTransaction

          public void beginTransaction()

      Description copied from interface: `DocumentLoader`
      Begins a transaction
      Specified by:
        `beginTransaction` in interface `DocumentLoader`

    - #### load

          public void load(SolrInputDocument doc)
                    throws IOException,
                           SolrServerException

      Description copied from interface: `DocumentLoader`
      Loads the given document into the destination
      Specified by:
        `load` in interface `DocumentLoader`
      Throws:
        `IOException`
        `SolrServerException`

    - #### commitTransaction

          public void commitTransaction()
                                 throws SolrServerException,
                                        IOException

      Description copied from interface: `DocumentLoader`
      Sends any outstanding documents to the destination and waits for a positive or negative ack (i.e. exception). Depending on the outcome the caller should then commit or rollback the current flume transaction correspondingly.
      Specified by:
        `commitTransaction` in interface `DocumentLoader`
      Throws:
        `IOException` - If there is a low-level I/O error.
        `SolrServerException`

    - #### rollbackTransaction

          public UpdateResponse rollbackTransaction()
                                             throws SolrServerException,
                                                    IOException

      Description copied from interface: `DocumentLoader`
      Performs a rollback of all non-committed documents pending.

      Note that this is not a true rollback as in databases. Content you have previously added may have already been committed due to autoCommit, buffer full, other client performing a commit etc. So this is only a best-effort rollback.

      Specified by:
        `rollbackTransaction` in interface `DocumentLoader`
      Throws:
        `IOException` - If there is a low-level I/O error.
        `SolrServerException`

    - #### shutdown

          public void shutdown()
                        throws IOException

      Description copied from interface: `DocumentLoader`
      Releases allocated resources
      Specified by:
        `shutdown` in interface `DocumentLoader`
      Throws:
        `IOException`

    - #### ping

          public SolrPingResponse ping()
                                throws SolrServerException,
                                       IOException

      Description copied from interface: `DocumentLoader`
      Issues a ping request to check if the server is alive
      Specified by:
        `ping` in interface `DocumentLoader`
      Throws:
        `IOException` - If there is a low-level I/O error.
        `SolrServerException`

    - #### getSolrClient

          public SolrClient getSolrClient()

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.