Class DefaultConnectionNameGenerator

java.lang.Object
com.couchbase.client.dcp.DefaultConnectionNameGenerator
All Implemented Interfaces:
ConnectionNameGenerator

public class DefaultConnectionNameGenerator extends Object implements ConnectionNameGenerator
The default implementation for the ConnectionNameGenerator.

It generates a new name every time called, using the format specified by the Response Time Observability RFC.

  • Field Details

    • INSTANCE

      public static final ConnectionNameGenerator INSTANCE
      A connection name generator with a default User Agent string.
  • Method Details

    • forProduct

      public static DefaultConnectionNameGenerator forProduct(String productName, String productVersion, String... comments)
      Returns a new connection name generator that includes the given product information in the User Agent string.
      Parameters:
      productName - Product name to include in the User Agent string.
      productVersion - Optional product version to include in the User Agent string. May be null.
      comments - Optional comments to include in the User Agent string.
    • name

      public String name()
      Description copied from interface: ConnectionNameGenerator
      Generates the name for a DCP Connection.

      The UTF-8 encoding of the name must be no longer than 200 bytes.

      Specified by:
      name in interface ConnectionNameGenerator
    • extractConnectionId

      @Nullable public static String extractConnectionId(String connectionName)
      Returns the connection ID from the given connection name, or null if the connection name was not generated by this connection name generator.
    • toString

      public String toString()
      Overrides:
      toString in class Object