Interface BoltProtocol

All Known Implementing Classes:
BoltProtocolV3, BoltProtocolV4, BoltProtocolV41, BoltProtocolV42, BoltProtocolV43, BoltProtocolV44, BoltProtocolV5

public interface BoltProtocol
  • Method Details

    • createMessageFormat

      MessageFormat createMessageFormat()
      Instantiate MessageFormat used by this Bolt protocol verison.
      Returns:
      new message format.
    • initializeChannel

      void initializeChannel(String userAgent, AuthToken authToken, RoutingContext routingContext, io.netty.channel.ChannelPromise channelInitializedPromise)
      Initialize channel after it is connected and handshake selected this protocol version.
      Parameters:
      userAgent - the user agent string.
      authToken - the authentication token.
      routingContext - the configured routing context
      channelInitializedPromise - the promise to be notified when initialization is completed.
    • 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)
      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 be TransactionConfig.empty() when absent.
      txType - the Kernel transaction type
      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

      CompletionStage<Void> rollbackTransaction(Connection connection)
      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.
    • runInAutoCommitTransaction

      ResultCursorFactory runInAutoCommitTransaction(Connection connection, Query query, Set<Bookmark> bookmarks, Consumer<org.neo4j.driver.internal.DatabaseBookmark> bookmarkConsumer, TransactionConfig config, long fetchSize)
      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.
      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

      Returns the protocol version. It can be used for version specific error messages.
      Returns:
      the protocol version.
    • forChannel

      static BoltProtocol forChannel(io.netty.channel.Channel channel)
      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

      static BoltProtocol forVersion(BoltProtocolVersion version)
      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.