use of dk.dbc.pgqueue.consumer.NonFatalQueueError in project solr-document-store by DBCDK.
the class Worker method makeWorker.
public JobConsumer<QueueJob> makeWorker() {
return new JobConsumer<QueueJob>() {
@Override
public void accept(Connection connection, QueueJob job, JobMetaData metaData) throws FatalQueueError, NonFatalQueueError, PostponedNonFatalQueueError {
log.info("job = {}, metadata = {}", job, metaData);
try {
JsonNode sourceDoc = docProducer.fetchSourceDoc(job);
SolrInputDocument solrDocument = docProducer.createSolrDocument(sourceDoc);
String bibliographicShardId = docProducer.bibliographicShardId(sourceDoc);
docProducer.deleteSolrDocuments(bibliographicShardId, job.getCommitwithin());
docProducer.deploy(solrDocument, job.getCommitwithin());
} catch (IOException ex) {
throw new NonFatalQueueError(ex);
} catch (SolrServerException ex) {
throw new FatalQueueError(ex);
}
}
};
}
Aggregations