Get objects that will be peristed
thanks @hg-ms do you think it might be of interest for you guys to incorporate some sort of a listener API for this inside the code? I am thinking about potential use cases like outbox pattern, Change Data Capture integration etc... this would be beneficial I think...
Originally posted by @guykatz in https://github.com/eclipse-store/store/discussions/134#discussioncomment-8404941
There is a way to get all objects that will be persisted, but it is a bit hacky: To do so you need to create a storer and cast it to BinaryStorer.Default. Between the store and commit you can retrieve all objects that will be persisted.
BinaryStorer.Default storer = (Default) storage.createLazyStorer();
storer.store(root);
storer.iterateMergeableEntries((oid, instance) -> {System.out.println("oid: " + oid + " instance: " + instance);} );
storer.commit();
This is not very user friendly, mybe we can add a more convenient API
vote + 1, the feature could be a good alternative for mongodb change stream.
Maybe we should consider adding a concept like the Hibernate interceptors.
added method void registerObjectCollector(PersistenceObjectCollector collector) to the storers that allows to add custom collector implementations.