com.cloudera.cdk.morphline.solr
Interface DocumentLoader

All Known Implementing Classes:
SolrServerDocumentLoader

public interface DocumentLoader

A vehicle to load a list of Solr documents into some kind of destination, such as a SolrServer or MapReduce RecordWriter.


Method Summary
 void beginTransaction()
          Begins a transaction
 void commitTransaction()
          Sends any outstanding documents to the destination and waits for a positive or negative ack (i.e.
 void load(org.apache.solr.common.SolrInputDocument doc)
          Loads the given document into the destination
 org.apache.solr.client.solrj.response.SolrPingResponse ping()
          Issues a ping request to check if the server is alive
 org.apache.solr.client.solrj.response.UpdateResponse rollbackTransaction()
          Performs a rollback of all non-committed documents pending.
 void shutdown()
          Releases allocated resources
 

Method Detail

beginTransaction

void beginTransaction()
                      throws IOException,
                             org.apache.solr.client.solrj.SolrServerException
Begins a transaction

Throws:
IOException
org.apache.solr.client.solrj.SolrServerException

load

void load(org.apache.solr.common.SolrInputDocument doc)
          throws IOException,
                 org.apache.solr.client.solrj.SolrServerException
Loads the given document into the destination

Throws:
IOException
org.apache.solr.client.solrj.SolrServerException

commitTransaction

void commitTransaction()
                       throws IOException,
                              org.apache.solr.client.solrj.SolrServerException
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.

Throws:
IOException - If there is a low-level I/O error.
org.apache.solr.client.solrj.SolrServerException

rollbackTransaction

org.apache.solr.client.solrj.response.UpdateResponse rollbackTransaction()
                                                                         throws IOException,
                                                                                org.apache.solr.client.solrj.SolrServerException
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.

Throws:
IOException - If there is a low-level I/O error.
org.apache.solr.client.solrj.SolrServerException

shutdown

void shutdown()
              throws IOException,
                     org.apache.solr.client.solrj.SolrServerException
Releases allocated resources

Throws:
IOException
org.apache.solr.client.solrj.SolrServerException

ping

org.apache.solr.client.solrj.response.SolrPingResponse ping()
                                                            throws IOException,
                                                                   org.apache.solr.client.solrj.SolrServerException
Issues a ping request to check if the server is alive

Throws:
IOException - If there is a low-level I/O error.
org.apache.solr.client.solrj.SolrServerException


Copyright © 2013 Cloudera. All rights reserved.