- All Known Implementing Classes:
BoltProtocolV3
,BoltProtocolV4
,BoltProtocolV41
,BoltProtocolV42
,BoltProtocolV43
,BoltProtocolV44
,BoltProtocolV5
,BoltProtocolV51
,BoltProtocolV52
,BoltProtocolV53
,BoltProtocolV54
,BoltProtocolV55
,BoltProtocolV56
public interface BoltProtocol
-
Method Summary
Modifier and TypeMethodDescriptionbeginTransaction
(Connection connection, Set<Bookmark> bookmarks, TransactionConfig config, String txType, org.neo4j.driver.internal.GqlNotificationConfig GqlNotificationConfig, Logging logging, boolean flush) Begin an unmanaged transaction.CompletionStage<org.neo4j.driver.internal.DatabaseBookmark>
commitTransaction
(Connection connection) Commit the unmanaged transaction.InstantiateMessageFormat
used by this Bolt protocol verison.static BoltProtocol
forChannel
(io.netty.channel.Channel channel) Obtain an instance of the protocol for the given channel.static BoltProtocol
forVersion
(BoltProtocolVersion version) Obtain an instance of the protocol for the given channel.void
initializeChannel
(String userAgent, org.neo4j.driver.internal.BoltAgent boltAgent, AuthToken authToken, RoutingContext routingContext, io.netty.channel.ChannelPromise channelInitializedPromise, org.neo4j.driver.internal.GqlNotificationConfig GqlNotificationConfig, Clock clock) Initialize channel after it is connected and handshake selected this protocol version.void
prepareToCloseChannel
(io.netty.channel.Channel channel) Prepare to close channel before it is closed.rollbackTransaction
(Connection connection) Rollback the unmanaged transaction.runInAutoCommitTransaction
(Connection connection, Query query, Set<Bookmark> bookmarks, Consumer<org.neo4j.driver.internal.DatabaseBookmark> bookmarkConsumer, TransactionConfig config, long fetchSize, org.neo4j.driver.internal.GqlNotificationConfig GqlNotificationConfig, Logging logging) Execute the given query in an auto-commit transaction, i.e.runInUnmanagedTransaction
(Connection connection, Query query, UnmanagedTransaction tx, long fetchSize) Execute the given query in a running unmanaged transaction, i.e.telemetry
(Connection connection, Integer api) Sends telemetry message to the server.version()
Returns the protocol version.
-
Method Details
-
createMessageFormat
MessageFormat createMessageFormat()InstantiateMessageFormat
used by this Bolt protocol verison.- Returns:
- new message format.
-
initializeChannel
void initializeChannel(String userAgent, org.neo4j.driver.internal.BoltAgent boltAgent, AuthToken authToken, RoutingContext routingContext, io.netty.channel.ChannelPromise channelInitializedPromise, org.neo4j.driver.internal.GqlNotificationConfig GqlNotificationConfig, Clock clock) Initialize channel after it is connected and handshake selected this protocol version.- Parameters:
userAgent
- the user agent string.boltAgent
- the bolt agentauthToken
- the authentication token.routingContext
- the configured routing contextchannelInitializedPromise
- the promise to be notified when initialization is completed.GqlNotificationConfig
- the notification configurationclock
- the clock to use
-
prepareToCloseChannel
void prepareToCloseChannel(io.netty.channel.Channel channel) Prepare to close channel before it is closed.- Parameters:
channel
- the channel to close.
-
beginTransaction
CompletionStage<Void> beginTransaction(Connection connection, Set<Bookmark> bookmarks, TransactionConfig config, String txType, org.neo4j.driver.internal.GqlNotificationConfig GqlNotificationConfig, Logging logging, boolean flush) Begin an unmanaged transaction.- Parameters:
connection
- the connection to use.bookmarks
- the bookmarks. Never null, should be empty when there are no bookmarks.config
- the transaction configuration. Never null, should beTransactionConfig.empty()
when absent.txType
- the Kernel transaction typeGqlNotificationConfig
- the notification configurationlogging
- the driver loggingflush
- defines whether to flush the message to the connection- Returns:
- a completion stage completed when transaction is started or completed exceptionally when there was a failure.
-
commitTransaction
CompletionStage<org.neo4j.driver.internal.DatabaseBookmark> commitTransaction(Connection connection) Commit the unmanaged transaction.- Parameters:
connection
- the connection to use.- Returns:
- a completion stage completed with a bookmark when transaction is committed or completed exceptionally when there was a failure.
-
rollbackTransaction
Rollback the unmanaged transaction.- Parameters:
connection
- the connection to use.- Returns:
- a completion stage completed when transaction is rolled back or completed exceptionally when there was a failure.
-
telemetry
Sends telemetry message to the server.- Parameters:
api
- The api number.- Returns:
- Promise of message be delivered
-
runInAutoCommitTransaction
ResultCursorFactory runInAutoCommitTransaction(Connection connection, Query query, Set<Bookmark> bookmarks, Consumer<org.neo4j.driver.internal.DatabaseBookmark> bookmarkConsumer, TransactionConfig config, long fetchSize, org.neo4j.driver.internal.GqlNotificationConfig GqlNotificationConfig, Logging logging) Execute the given query in an auto-commit transaction, i.e.SimpleQueryRunner.run(Query)
.- Parameters:
connection
- the network connection to use.query
- the cypher to execute.bookmarkConsumer
- the database bookmark consumer.config
- the transaction config for the implicitly started auto-commit transaction.fetchSize
- the record fetch size for PULL message.GqlNotificationConfig
- the notification configurationlogging
- the driver logging- Returns:
- stage with cursor.
-
runInUnmanagedTransaction
ResultCursorFactory runInUnmanagedTransaction(Connection connection, Query query, UnmanagedTransaction tx, long fetchSize) Execute the given query in a running unmanaged transaction, i.e.SimpleQueryRunner.run(Query)
.- Parameters:
connection
- the network connection to use.query
- the cypher to execute.tx
- the transaction which executes the query.fetchSize
- the record fetch size for PULL message.- Returns:
- stage with cursor.
-
version
BoltProtocolVersion version()Returns the protocol version. It can be used for version specific error messages.- Returns:
- the protocol version.
-
forChannel
Obtain an instance of the protocol for the given channel.- Parameters:
channel
- the channel to get protocol for.- Returns:
- the protocol.
- Throws:
ClientException
- when unable to find protocol version for the given channel.
-
forVersion
Obtain an instance of the protocol for the given channel.- Parameters:
version
- the version of the protocol.- Returns:
- the protocol.
- Throws:
ClientException
- when unable to find protocol with the given version.
-