Class DefaultPulsarClientConfiguration

java.lang.Object
io.micronaut.pulsar.config.AbstractPulsarConfiguration
io.micronaut.pulsar.config.DefaultPulsarClientConfiguration
All Implemented Interfaces:
PulsarClientConfiguration

@ConfigurationProperties("pulsar") @Requires("pulsar") @Requires(missingBeans=PulsarClientConfiguration.class) public final class DefaultPulsarClientConfiguration extends AbstractPulsarConfiguration implements PulsarClientConfiguration
Default properties holder for Pulsar client configuration.
Since:
1.0
Author:
Haris Secic
  • Constructor Details

    • DefaultPulsarClientConfiguration

      protected DefaultPulsarClientConfiguration(io.micronaut.context.env.Environment environment, @Nullable @PulsarServiceUrlProvider @Nullable org.apache.pulsar.client.api.ServiceUrlProvider serviceUrlProvider)
      Constructs the default Pulsar Client configuration.
      Parameters:
      environment - Environment
      serviceUrlProvider - Pulsars service URL provider
  • Method Details

    • getIoThreads

      public Optional<Integer> getIoThreads()
      Specified by:
      getIoThreads in interface PulsarClientConfiguration
      Returns:
      Number of threads to allow for Pulsar library.
    • setIoThreads

      public void setIoThreads(Integer ioThreads)
      Parameters:
      ioThreads - Number of threads to use with read operations
    • getListenerThreads

      public Optional<Integer> getListenerThreads()
      Specified by:
      getListenerThreads in interface PulsarClientConfiguration
      Returns:
      Number of threads to allow for listeners from IO threads defined for Pulsar library
    • setListenerThreads

      public void setListenerThreads(Integer listenerThreads)
      Parameters:
      listenerThreads - Number of threads to use with message example.java.listeners.
    • setAuthenticationJwt

      public void setAuthenticationJwt(@Nullable @Nullable String authenticationJwt)
    • getSslProvider

      public Optional<String> getSslProvider()
      Specified by:
      getSslProvider in interface PulsarClientConfiguration
      Returns:
      SSL provider if any for Pulsar to client communication encryption
    • setTlsTrustStorePath

      public void setTlsTrustStorePath(String tlsTrustStorePath)
    • getTlsTrustStorePath

      public Optional<String> getTlsTrustStorePath()
      Specified by:
      getTlsTrustStorePath in interface PulsarClientConfiguration
    • setTlsTrustStorePassword

      public void setTlsTrustStorePassword(String tlsTrustStorePassword)
    • getTlsTrustStorePassword

      public Optional<String> getTlsTrustStorePassword()
      Specified by:
      getTlsTrustStorePassword in interface PulsarClientConfiguration
      Returns:
      trust store password if any, trust stores don't contain any sensitive information but often work better with password in Java context.
    • setTlsCertFilePath

      public void setTlsCertFilePath(String tlsCertFilePath)
    • getTlsCertFilePath

      public Optional<String> getTlsCertFilePath()
      Specified by:
      getTlsCertFilePath in interface PulsarClientConfiguration
      Returns:
      TLS certificate file path if any for TLS communication between Pulsar & clients.
    • setTlsVerifyHostname

      public void setTlsVerifyHostname(Boolean tlsVerifyHostname)
    • getTlsVerifyHostname

      public Optional<Boolean> getTlsVerifyHostname()
      Description copied from interface: PulsarClientConfiguration
      Useful in development environment for using with local host or such.
      Specified by:
      getTlsVerifyHostname in interface PulsarClientConfiguration
      Returns:
      Whether to verify TLS certificate host or not.
    • setTlsAllowInsecureConnection

      public void setTlsAllowInsecureConnection(Boolean tlsAllowInsecureConnection)
    • getTlsAllowInsecureConnection

      public Optional<Boolean> getTlsAllowInsecureConnection()
      Specified by:
      getTlsAllowInsecureConnection in interface PulsarClientConfiguration
      Returns:
      Allow insecure connection when TLS certificate is set or not.
    • setTlsCiphers

      public void setTlsCiphers(Set<String> tlsCiphers)
    • getTlsCiphers

      public Optional<Set<String>> getTlsCiphers()
      Description copied from interface: PulsarClientConfiguration
      Ciphers like TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256.
      Specified by:
      getTlsCiphers in interface PulsarClientConfiguration
      Returns:
      Permitted ciphers for TLS.
    • setTlsProtocols

      public void setTlsProtocols(Set<String> tlsProtocols)
    • getTlsProtocols

      public Optional<Set<String>> getTlsProtocols()
      Description copied from interface: PulsarClientConfiguration
      Protocols like TLSv1.3, TLSv1.2.
      Specified by:
      getTlsProtocols in interface PulsarClientConfiguration
      Returns:
      Permitted protocols for TLS.
    • setSslProvider

      public void setSslProvider(String sslProvider)
      Defaults to default JVM provider.
      Parameters:
      sslProvider - The name of the security provider used for SSL connections.
    • getServiceUrl

      public String getServiceUrl()
      Specified by:
      getServiceUrl in interface PulsarClientConfiguration
      Returns:
      Apache Pulsar cluster address (IP or domain or hostname + port)
    • setServiceUrl

      public void setServiceUrl(@Nullable @Nullable String serviceUrl)
      Parameters:
      serviceUrl - URL to Pulsar cluster
    • getServiceUrlProvider

      public Optional<org.apache.pulsar.client.api.ServiceUrlProvider> getServiceUrlProvider()
      Description copied from interface: PulsarClientConfiguration
      Optional provider for Pulsar services URL.
      Specified by:
      getServiceUrlProvider in interface PulsarClientConfiguration
      Returns:
      Optional bean for fetching Pulsar services URLs
    • getAuthentication

      public org.apache.pulsar.client.api.Authentication getAuthentication()
      Specified by:
      getAuthentication in interface PulsarClientConfiguration
      Returns:
      Authentication method for pulsar clients
    • getOauthAudience

      public Optional<String> getOauthAudience()
      Must be set for usage with the OAuth2 authentication.
      Returns:
      String representing client application willing to listen to
    • setOauthAudience

      public void setOauthAudience(String oauthAudience)
      Parameters:
      oauthAudience - OAuth2 audience
    • getOauthCredentialsUrl

      public Optional<URL> getOauthCredentialsUrl()
    • setOauthCredentialsUrl

      public void setOauthCredentialsUrl(URL oauthCredentialsUrl)
      Parameters:
      oauthCredentialsUrl - URL or a path to a file containing client id, client secret, and such for OAuth2 client application.
    • getOauthIssuerUrl

      public URL getOauthIssuerUrl()
    • setOauthIssuerUrl

      public void setOauthIssuerUrl(URL oauthIssuerUrl)
      Parameters:
      oauthIssuerUrl - URL of the OAuth2 Token issuer
    • getUseDeadLetterQueue

      public Boolean getUseDeadLetterQueue()
    • setUseDeadLetterQueue

      public void setUseDeadLetterQueue(Boolean useDeadLetterQueue)
      If not set defaults to true which means that after max number of retries failed message is sent to DLQ and won't be resent again.
      Parameters:
      useDeadLetterQueue - Use DLQ for Pulsar Consumers by default or not.
    • getDefaultMaxRetryDlq

      public int getDefaultMaxRetryDlq()
    • setDefaultMaxRetryDlq

      public void setDefaultMaxRetryDlq(int defaultMaxRetryDlq)
      If not set defaults to 16 (Pulsar library default). #useDeadLetterQueue must be enabled or else this value is ignored.
      Parameters:
      defaultMaxRetryDlq - Default max number of retries before sending message to DLQ for all consumers.
    • getDefaultTenant

      public Optional<String> getDefaultTenant()
      Description copied from interface: PulsarClientConfiguration
      Useful for avoiding hard coding tenant name into every annotation value for producers, consumers, or readers.
      Specified by:
      getDefaultTenant in interface PulsarClientConfiguration
      Returns:
      Default tenant name if any.
    • setDefaultTenant

      public void setDefaultTenant(String defaultTenant)
      Use in combination with ${tenant} placeholder in PulsarConsumer.topic(), PulsarConsumer.topics(), PulsarConsumer.topicsPattern(), PulsarReader.topic(), PulsarProducer.topic() to avoid hardcoding tenant name into source code through mentioned annotations.

      This property will be ignored if multi-tenancy module is enabled.

      Parameters:
      defaultTenant - Default Apache Pulsar tenant name to apply on dynamic topic names.