use of org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPeriodicQueryResultStorage in project incubator-rya by apache.
the class AccumuloCreatePeriodicPCJ method updateFluoAppAndRegisterWithKafka.
private String updateFluoAppAndRegisterWithKafka(final String ryaInstance, final String fluoAppName, String sparql, String periodicTopic, String bootStrapServers) throws RepositoryException, MalformedQueryException, SailException, QueryEvaluationException, PcjException, RyaDAOException, UnsupportedQueryException, PeriodicQueryCreationException {
requireNonNull(sparql);
requireNonNull(periodicTopic);
requireNonNull(bootStrapServers);
final PeriodicQueryResultStorage periodicStorage = new AccumuloPeriodicQueryResultStorage(getConnector(), ryaInstance);
// Connect to the Fluo application that is updating this instance's PCJs.
final AccumuloConnectionDetails cd = super.getAccumuloConnectionDetails();
try (final FluoClient fluoClient = new FluoClientFactory().connect(cd.getUsername(), new String(cd.getUserPass()), cd.getInstanceName(), cd.getZookeepers(), fluoAppName)) {
// Initialize the PCJ within the Fluo application.
final CreatePeriodicQuery periodicPcj = new CreatePeriodicQuery(fluoClient, periodicStorage);
PeriodicNotificationClient periodicClient = new KafkaNotificationRegistrationClient(periodicTopic, createProducer(bootStrapServers));
return periodicPcj.withRyaIntegration(sparql, periodicClient, getConnector(), ryaInstance).getQueryId();
}
}
use of org.apache.rya.indexing.pcj.storage.accumulo.AccumuloPeriodicQueryResultStorage in project incubator-rya by apache.
the class AccumuloDeletePeriodicPCJ method stopUpdatingPCJ.
private void stopUpdatingPCJ(final String ryaInstance, final String fluoAppName, final String pcjId, final String topic, final String brokers) throws UnsupportedQueryException, MalformedQueryException, QueryDeletionException {
requireNonNull(fluoAppName);
requireNonNull(pcjId);
// Connect to the Fluo application that is updating this instance's PCJs.
final AccumuloConnectionDetails cd = super.getAccumuloConnectionDetails();
try (final FluoClient fluoClient = new FluoClientFactory().connect(cd.getUsername(), new String(cd.getUserPass()), cd.getInstanceName(), cd.getZookeepers(), fluoAppName)) {
// Delete the PCJ from the Fluo App.
PeriodicQueryResultStorage periodic = new AccumuloPeriodicQueryResultStorage(getConnector(), ryaInstance);
DeletePeriodicQuery deletePeriodic = new DeletePeriodicQuery(fluoClient, periodic);
deletePeriodic.deletePeriodicQuery(pcjId, getPeriodicNotificationClient(topic, brokers));
}
}
Aggregations