- Enclosing class:
- SessionConfig
SessionConfig which will be used to create a session.-
Method Summary
Modifier and TypeMethodDescriptionbuild()withBookmarkManager(BookmarkManager bookmarkManager) Sets aBookmarkManagerimplementation for the session to use.withBookmarks(Iterable<Bookmark> bookmarks) Set the initial bookmarks to be used in a session.withBookmarks(Bookmark... bookmarks) Set the initial bookmarks to be used in a session.withDatabase(String database) Set the database that the newly created session is going to connect to.Set the type of access required by units of work in this session, e.g.withFetchSize(long size) Specify how many records to fetch in each batch for this session.withImpersonatedUser(String impersonatedUser) Set the impersonated user that the newly created session is going to use for query execution.
-
Method Details
-
withBookmarks
Set the initial bookmarks to be used in a session.First transaction in a session will ensure that server hosting is at least as up-to-date as the latest transaction referenced by the supplied bookmarks. The bookmarks can be obtained via
Session.lastBookmarks(),AsyncSession.lastBookmarks(), and/orReactiveSession.lastBookmarks().- Parameters:
bookmarks- a series of initial bookmarks. Bothnullvalue and empty array are permitted, and indicate that the bookmarks do not exist or are unknown.- Returns:
- this builder.
-
withBookmarks
Set the initial bookmarks to be used in a session. First transaction in a session will ensure that server hosting is at least as up-to-date as the latest transaction referenced by the supplied bookmarks. The bookmarks can be obtained viaSession.lastBookmarks(),AsyncSession.lastBookmarks(), and/orReactiveSession.lastBookmarks().Multiple immutable sets of bookmarks may be joined in the following way:
Set<Bookmark> bookmarks = new HashSet<>(); bookmarks.addAll( session1.lastBookmarks() ); bookmarks.addAll( session2.lastBookmarks() ); bookmarks.addAll( session3.lastBookmarks() );- Parameters:
bookmarks- initial references to some previous transactions. Bothnullvalue and empty iterable are permitted, and indicate that the bookmarks do not exist or are unknown.- Returns:
- this builder
-
withDefaultAccessMode
Set the type of access required by units of work in this session, e.g.read accessorwrite access. This access mode is used to route transactions in the session to the server who has the right to carry out the specified operations.- Parameters:
mode- access mode.- Returns:
- this builder.
-
withDatabase
Set the database that the newly created session is going to connect to.For connecting to servers that support multi-databases, it is highly recommended to always set the database explicitly in the
SessionConfigfor each session. If the database name is not set, then session defaults to connecting to the default database configured in server configuration.For servers that do not support multi-databases, leave this database value unset. The only database will be used instead.
- Parameters:
database- the database the session going to connect to. Provided value should not benull.- Returns:
- this builder.
-
withFetchSize
Specify how many records to fetch in each batch for this session. This config will overrides the default value set onConfig.fetchSize(). This config is only valid when the driver is used with servers that support Bolt V4 (Server version 4.0 and later). Bolt V4 enables pulling records in batches to allow client to take control of data population and apply back pressure to server. This config specifies the default fetch size for all query runs usingSessionandAsyncSession. By default, the value is set to1000. Use-1to disables back pressure and config client to pull all records at once after each run. This config only applies to run result obtained viaSessionandAsyncSession. As withRxSession, the batch size is provided viaSubscription.request(long)instead.- Parameters:
size- the default record fetch size when pulling records in batches using Bolt V4.- Returns:
- this builder
-
withImpersonatedUser
Set the impersonated user that the newly created session is going to use for query execution.The principal provided to the driver on creation must have the necessary permissions to impersonate and run queries as the impersonated user.
When
withDatabase(String)is not used, the driver will discover the default database name of the impersonated user on first session usage. From that moment, the discovered database name will be used as the default database name for the whole lifetime of the new session.Compatible with 4.4+ only. You MUST have all servers running 4.4 version or above and communicating over Bolt 4.4 or above.
- Parameters:
impersonatedUser- the user to impersonate. Provided value should not benull.- Returns:
- this builder
-
withBookmarkManager
Sets aBookmarkManagerimplementation for the session to use.By default, bookmark manager is effectively disabled.
- Parameters:
bookmarkManager- bookmark manager implementation. Providingnulleffectively disables bookmark manager.- Returns:
- this builder.
-
build
-