Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.18 KB

File metadata and controls

49 lines (34 loc) · 1.18 KB

Neo4j Transaction Event Listener Extension example code

Build this extension

mvn clean package

Install the plugin

Copy the jar into the /plugins directory of your Neo4j server

copy target/*.jar <NEO4J_HOME>/plugins

Restart Neo4j

./bin/neo4j restart

Test

This plugin will add some attribute to every create node

CREATE (n:Person {name: "Chris"})

Then check the data :

MATCH (n:Person)
RETURN n{.*}

//Result
╒═══════════════════════════════════════════════╕
│"n"                                            │
╞═══════════════════════════════════════════════╡
│{"name":"Chris","setByTxListener":"some value"}│
└───────────────────────────────────────────────┘

A line is also logged during the afterCommit phase

2022-01-15 17:09:19.814+0000 INFO  [neo4j/3bfca502] Logging after commit on transaction with ID 7