Class TlsPolicy.Builder

java.lang.Object
org.apache.pulsar.client.api.v5.config.TlsPolicy.Builder
Enclosing class:
TlsPolicy

public static final class TlsPolicy.Builder extends Object
Builder for TlsPolicy.
  • Method Details

    • trustCertsFilePath

      public TlsPolicy.Builder trustCertsFilePath(String trustCertsFilePath)
      Path to the trusted CA certificate file (PEM format).
      Parameters:
      trustCertsFilePath - the trust store path
      Returns:
      this builder
    • keyFilePath

      public TlsPolicy.Builder keyFilePath(String keyFilePath)
      Path to the client private key file (PEM format) for mutual TLS.
      Parameters:
      keyFilePath - the client key path
      Returns:
      this builder
    • certificateFilePath

      public TlsPolicy.Builder certificateFilePath(String certificateFilePath)
      Path to the client certificate file (PEM format) for mutual TLS.
      Parameters:
      certificateFilePath - the client certificate path
      Returns:
      this builder
    • allowInsecureConnection

      public TlsPolicy.Builder allowInsecureConnection(boolean allowInsecureConnection)
      Whether to allow connecting to brokers with untrusted certificates. Default false. Enable only for development.
      Parameters:
      allowInsecureConnection - whether to skip certificate validation
      Returns:
      this builder
    • enableHostnameVerification

      public TlsPolicy.Builder enableHostnameVerification(boolean enableHostnameVerification)
      Whether to verify the broker hostname against the certificate. Default true.
      Parameters:
      enableHostnameVerification - whether to verify the hostname
      Returns:
      this builder
    • build

      public TlsPolicy build()
      Returns:
      a new TlsPolicy instance