use of org.springframework.data.neo4j.rest.SpringCypherRestGraphDatabase in project elasticsearch-river-neo4j by sksamuel.
the class Neo4jRiverIntTest method setupElasticAndNeo4jClient.
@Before
public void setupElasticAndNeo4jClient() throws Exception {
Settings globalSettings = settingsBuilder().loadFromClasspath("settings.yml").build();
String json = copyToStringFromClasspath("/neo4j-inttest-river.json");
Settings riverSettings = settingsBuilder().loadFromSource(json).build();
index = riverSettings.get("index.name");
type = riverSettings.get("index.type");
String uri = riverSettings.get("neo4j.uri");
logger.debug("Connecting to neo4j @ {}", uri);
db = new SpringCypherRestGraphDatabase(uri);
logger.debug("Starting local elastic...");
Tuple<Settings, Environment> initialSettings = InternalSettingsPerparer.prepareSettings(globalSettings, true);
if (!initialSettings.v2().configFile().exists()) {
FileSystemUtils.mkdirs(initialSettings.v2().configFile());
}
if (!initialSettings.v2().logsFile().exists()) {
FileSystemUtils.mkdirs(initialSettings.v2().logsFile());
}
node = nodeBuilder().local(true).settings(globalSettings).node();
logger.info("Create river [{}]", river);
node.client().prepareIndex("_river", river, "_meta").setSource(json).execute().actionGet();
logger.debug("Running Cluster Health");
ClusterHealthResponse clusterHealth = node.client().admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet();
logger.info("Done Cluster Health, status " + clusterHealth.getStatus());
GetResponse response = node.client().prepareGet("_river", river, "_meta").execute().actionGet();
assertTrue(response.isExists());
logger.debug("...elasticized ok");
}
use of org.springframework.data.neo4j.rest.SpringCypherRestGraphDatabase in project elasticsearch-river-neo4j by sksamuel.
the class Neo4jDriver method start.
@Override
public void start() {
logger.info("Starting neo4j river");
ElasticOperationWorker worker = new ElasticOperationWorker(client);
SpringCypherRestGraphDatabase db = new SpringCypherRestGraphDatabase(uri);
Neo4jIndexer indexer = new Neo4jIndexer(db, worker, indexingStrategy, deletingStategy, index, type, labels);
Neo4jPoller poller = new Neo4jPoller(indexer, interval);
executor = Executors.newFixedThreadPool(2);
executor.submit(worker);
executor.submit(poller);
logger.debug("Neo4j river started");
}
Aggregations