Interface Neo4jBookmarkManager


@API(status=STABLE, since="6.1.1") public sealed interface Neo4jBookmarkManager
Responsible for storing, updating and retrieving the bookmarks of Neo4j's transaction.
Since:
6.0
Author:
Michael J. Simons
  • Method Details

    • create

      static Neo4jBookmarkManager create()
      Returns the default bookmark manager.
      Returns:
      the default bookmark manager
    • createReactive

      static Neo4jBookmarkManager createReactive()
      Returns:
      default reactive version of bookmark manager
    • create

      static Neo4jBookmarkManager create(@Nullable Supplier<Set<org.neo4j.driver.Bookmark>> bookmarksSupplier)
      Use this factory method to add supplier of initial "seeding" bookmarks to the transaction managers

      While this class will make sure that the supplier will be accessed in a thread-safe manner, it is the caller's duty to provide a thread safe supplier (not changing the seed during a call, etc.).

      Parameters:
      bookmarksSupplier - A supplier for seeding bookmarks, can be null. The supplier is free to provide different bookmarks on each call.
      Returns:
      A bookmark manager
    • createReactive

      static Neo4jBookmarkManager createReactive(@Nullable Supplier<Set<org.neo4j.driver.Bookmark>> bookmarksSupplier)
      Use this factory method to add supplier of initial "seeding" bookmarks to the transaction managers

      While this class will make sure that the supplier will be accessed in a thread-safe manner, it is the caller's duty to provide a thread safe supplier (not changing the seed during a call, etc.).

      Parameters:
      bookmarksSupplier - A supplier for seeding bookmarks, can be null. The supplier is free to provide different bookmarks on each call.
      Returns:
      A reactive bookmark manager
    • noop

      @API(status=STABLE, since="6.1.11") static Neo4jBookmarkManager noop()
      Use this bookmark manager at your own risk, it will effectively disable any bookmark management by dropping all bookmarks and never supplying any. In a cluster you will be at a high risk of experiencing stale reads. In a single instance it will most likely not make any difference.

      In a cluster this can be a sensible approach only and if only you can tolerate stale reads and are not in danger of overwriting old data.

      Returns:
      A noop bookmark manager, dropping new bookmarks immediately, never supplying bookmarks.
      Since:
      6.1.11
    • getBookmarks

      Collection<org.neo4j.driver.Bookmark> getBookmarks()
      No need to introspect this collection ever. The Neo4j driver will together with the cluster figure out which of the bookmarks is the most recent one.
      Returns:
      a collection of currently known bookmarks
    • updateBookmarks

      void updateBookmarks(Collection<org.neo4j.driver.Bookmark> usedBookmarks, Collection<org.neo4j.driver.Bookmark> newBookmarks)
      Refreshes the bookmark manager with the newBookmarks new bookmarks received after the last transaction committed. The collection of usedBookmarks should be removed from the list of known bookmarks.
      Parameters:
      usedBookmarks - The collection of bookmarks known prior to the end of a transaction
      newBookmarks - The bookmarks received after the end of a transaction
      See Also:
    • setApplicationEventPublisher

      default void setApplicationEventPublisher(@Nullable ApplicationEventPublisher applicationEventPublisher)
      A hook for bookmark managers supporting events.
      Parameters:
      applicationEventPublisher - An event publisher. If null, no events will be published.