File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed
main/kotlin/streams/utils
test/kotlin/streams/utils
consumer/src/main/kotlin/streams Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,10 @@ object Neo4jUtils {
4141 .resolveDependency(LogService ::class .java)
4242 }
4343
44- fun isEnterpriseEdition (db : GraphDatabaseAPI ): Boolean {
44+ fun isCluster (db : GraphDatabaseAPI ): Boolean {
4545 try {
46- return db.execute("""
47- CALL dbms.components() YIELD edition
48- RETURN edition = "enterprise" AS isEnterprise
49- """ .trimIndent()).columnAs<Boolean >(" isEnterprise" ).next()
46+ db.execute(" CALL dbms.cluster.role()" ).columnAs<String >(" role" ).next()
47+ return true
5048 } catch (e: QueryExecutionException ) {
5149 if (e.statusCode.equals(" Neo.ClientError.Procedure.ProcedureNotFound" , ignoreCase = true )) {
5250 return false
Original file line number Diff line number Diff line change 11package streams.utils
22
33import org.junit.*
4- import org.neo4j.kernel.impl.logging.LogService
54import org.neo4j.kernel.internal.GraphDatabaseAPI
65import org.neo4j.test.TestGraphDatabaseFactory
76import kotlin.test.assertFalse
@@ -33,8 +32,8 @@ class Neo4jUtilsTest {
3332 }
3433
3534 @Test
36- fun shouldCheckIfIsEnterpriseEdition () {
37- val isEnterprise = Neo4jUtils .isEnterpriseEdition (db)
35+ fun shouldCheckIfIsACluster () {
36+ val isEnterprise = Neo4jUtils .isCluster (db)
3837 assertFalse { isEnterprise }
3938 }
4039
Original file line number Diff line number Diff line change @@ -60,8 +60,8 @@ class StreamsEventSinkExtensionFactory : KernelExtensionFactory<StreamsEventSink
6060 log,
6161 db)
6262 // start the Sink
63- if (Neo4jUtils .isEnterpriseEdition (db)) {
64- log.info(" The Sink module is running in an enterprise edition , checking for the ${Neo4jUtils .LEADER } " )
63+ if (Neo4jUtils .isCluster (db)) {
64+ log.info(" The Sink module is running in a cluster , checking for the ${Neo4jUtils .LEADER } " )
6565 Neo4jUtils .executeInLeader(db, log) { initSinkModule() }
6666 } else {
6767 // check if is writeable instance
You can’t perform that action at this time.
0 commit comments