sebastiandaschner blog
Undo feature with Neo4J & Enterprise Java
thursday, december 24, 2020I’ve created an example how to implement an undo feature in a Quarkus application that uses a Neo4J database. From a user perspective, an undo action might look little spectacular, but once you know what needs to be taken into account on a database side, it’s everything but trivial. Especially in graph databases, we need to take the relationships into account.
In a previous video, I showed to how integrate Neo4J in a Quarkus application. This example is based on that coffee shop application.
This example is a proof of concept, a starting point on how such a feature can be implemented.
The code is based on the Neo4j Streaming Data Integrations plugin, which runs in our Neo4J instance and emits Change Data Capture (CDC) data representations.
In our example, we don’t stream CDC events, but rather persist the transaction data in separate :Action
nodes directly in the graph, which can be used for the future undo action.
You find the source code to all examples below.
Resources
You can try out the example yourself. The following repositories contain the updated Quarkus application and the Neo4J plugin that runs in your database instance:
Happy undoing!
Found the post useful? Subscribe to my newsletter for more free content, tips and tricks on IT & Java: