cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Kernel Extension reacting to instance role change

Hello. I'm developing a Neo4j java plugin using the ExtensionFactory. The plugin starts a background thread that listens for external events and manipulates the graph db. The plugin needs to be aware of the status of the instance it's running on, as only the leader can perform write operations against the database. When running on a multi-node cluster there is only one leader, and I understand that the leader can change. The question I have is how can my code detect when the instance's role changes from leader to follower and vice versa?

Thanks in advance!

1 ACCEPTED SOLUTION

I may have found the answer myself. There is a procedure:

CALL dbms.cluster.role(<database name>)
 
That returns the current instance's role for a given database name.

View solution in original post

1 REPLY 1

I may have found the answer myself. There is a procedure:

CALL dbms.cluster.role(<database name>)
 
That returns the current instance's role for a given database name.
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online