Interface BoltProtocol

All Known Implementing Classes:
BoltProtocolV3, BoltProtocolV4, BoltProtocolV41, BoltProtocolV42, BoltProtocolV43, BoltProtocolV44, BoltProtocolV5, BoltProtocolV51, BoltProtocolV52, BoltProtocolV53, BoltProtocolV54, BoltProtocolV55, BoltProtocolV56

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, 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 agent
      authToken - the authentication token.
      routingContext - the configured routing context
      channelInitializedPromise - the promise to be notified when initialization is completed.
      GqlNotificationConfig - the notification configuration
      clock - 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 be TransactionConfig.empty() when absent.
      txType - the Kernel transaction type
      GqlNotificationConfig - the notification configuration
      logging - the driver logging
      flush - 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

      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.
    • telemetry

      CompletionStage<Void> telemetry(Connection connection, Integer api)
      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 configuration
      logging - 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

      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.