Search in sources :

Example 1 with IncrementalRyaSubGraphExporter

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();
    }
}
Also used : KafkaProducer(org.apache.kafka.clients.producer.KafkaProducer) RyaSubGraph(org.apache.rya.api.domain.RyaSubGraph) IncrementalRyaSubGraphExporter(org.apache.rya.indexing.pcj.fluo.app.export.IncrementalRyaSubGraphExporter)

Aggregations

KafkaProducer (org.apache.kafka.clients.producer.KafkaProducer)1 RyaSubGraph (org.apache.rya.api.domain.RyaSubGraph)1 IncrementalRyaSubGraphExporter (org.apache.rya.indexing.pcj.fluo.app.export.IncrementalRyaSubGraphExporter)1