Skip to content

Allow seeding and retrieval of Neo4j bookmarks from the transaction managers. #2252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
michael-simons opened this issue May 10, 2021 · 0 comments
Assignees
Labels
type: enhancement A general enhancement

Comments

@michael-simons
Copy link
Collaborator

While both imperative and reactive transaction managers and the underlying support for Neo4j causal cluster bookmarks have been designed as black boxes and the bookmark manager is not intended to be configurable, there are some scenarios in which it would be helpful to retrieve the latest bookmark an application received from a cluster and seed the transaction system with some bookmarks available.

One of these scenarios is simple: Testing against a cluster database and seeding that database via a driver session outside Springs transaction management so that the code under test is not used to seed and assert, too.

The new APIs introduced for that should be considered experimental for the time being, but we intend to keep them around for the purpose mentioned above and support them in the future.

We will use Springs event system to retrieve the latest bookmark and allow exactly one supplier of bookmarks to seed the transaction system.

@michael-simons michael-simons added the type: enhancement A general enhancement label May 10, 2021
@michael-simons michael-simons added this to the 6.1.1 (2021.0.1) milestone May 10, 2021
@michael-simons michael-simons self-assigned this May 10, 2021
michael-simons added a commit that referenced this issue May 10, 2021
…nsaction managers.

This change introduces the `Neo4jBookmarksUpdatedEvent`. It will be published by both the imperative and reactive transaction managers as soon as any of them receives a new bookmark from the cluster. Applications will be able to listen to it by implementation `ApplicationListener<Neo4jBookmarksUpdatedEvent>`.  The event returns an unmodifiable view of new bookmarks.

In addition a new constructor has been added to the transaction managers for allowing the configuration of the bookmark system. `org.springframework.data.neo4j.core.transaction.Neo4jBookmarkManager#create(java.util.function.Supplier<java.util.Set<org.neo4j.driver.Bookmark>>)` can be used to add a supplier of bookmarks as seeding mechanism.

This closes #2252.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant