Realtime notifications of node changes

If you want real-time notification of node changes, this is exactly what APOC triggers are for. Whenever a new node is created, you can run arbitrary cypher.

Next comes the question of who the subscribers are. Neo4j does not itself implement any kind of pub/sub arrangement, and it's unlikely that it would because this is a separate concern that's better addressed by a different system. This is what things like neo4j-streams are for:

The idea is that whenever new nodes are created, you configure neo4j-streams to publish a message on a kafka topic. Your subscribers then subscribe to that kafka topic, not to neo4j. Kafka is a system that is purpose built for such pub/sub design patterns, so I'd recommend using something like that for this purpose.

1 Like