use of org.apache.rya.indexing.pcj.fluo.app.export.IncrementalRyaSubGraphExporter in project incubator-rya by apache.
the class KafkaRyaSubGraphExporterFactory method build.
/**
* Builds a {@link KafkaRyaSubGraphExporter}.
* @param context - {@link Context} object used to pass configuration parameters
* @return an Optional consisting of an IncrementalSubGraphExproter if it can be constructed
* @throws IncrementalExporterFactoryException
* @throws ConfigurationException
*/
@Override
public Optional<IncrementalResultExporter> build(final Context context) throws IncrementalExporterFactoryException, ConfigurationException {
final KafkaSubGraphExporterParameters exportParams = new KafkaSubGraphExporterParameters(context.getObserverConfiguration().toMap());
log.info("Exporter is enabled: {}", exportParams.getUseKafkaSubgraphExporter());
if (exportParams.getUseKafkaSubgraphExporter()) {
// Setup Kafka connection
final KafkaProducer<String, RyaSubGraph> producer = new KafkaProducer<String, RyaSubGraph>(exportParams.listAllConfig());
// Create the exporter
final IncrementalRyaSubGraphExporter exporter = new KafkaRyaSubGraphExporter(producer);
return Optional.of(exporter);
} else {
return Optional.absent();
}
}
Aggregations