Package io.micronaut.pulsar.config
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
-
Field Summary
Fields inherited from class io.micronaut.pulsar.config.AbstractPulsarConfiguration
DEFAULT_BOOTSTRAP_SERVER, DEFAULT_PULSAR_AUTHENTICATION, DEFAULT_PULSAR_MESSAGING_PORT, DEFAULT_SERVER_HOST_ADDRESS, PREFIX, TENANT_NAME_VALIDATOR, TOPIC_NAME_PATTERN_VALIDATOR, TOPIC_NAME_VALIDATOR -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultPulsarClientConfiguration(io.micronaut.context.env.Environment environment, @Nullable org.apache.pulsar.client.api.ServiceUrlProvider serviceUrlProvider) Constructs the default Pulsar Client configuration. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.pulsar.client.api.AuthenticationintUseful for avoiding hard coding tenant name into every annotation value for producers, consumers, or readers.Must be set for usage with the OAuth2 authentication.Optional<org.apache.pulsar.client.api.ServiceUrlProvider>Optional provider for Pulsar services URL.Ciphers like TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256.Protocols like TLSv1.3, TLSv1.2.Useful in development environment for using with local host or such.voidsetAuthenticationJwt(@Nullable String authenticationJwt) voidsetDefaultMaxRetryDlq(int defaultMaxRetryDlq) If not set defaults to 16 (Pulsar library default).voidsetDefaultTenant(String defaultTenant) Use in combination with ${tenant} placeholder inPulsarConsumer.topic(),PulsarConsumer.topics(),PulsarConsumer.topicsPattern(),PulsarReader.topic(),PulsarProducer.topic()to avoid hardcoding tenant name into source code through mentioned annotations.voidsetIoThreads(Integer ioThreads) voidsetListenerThreads(Integer listenerThreads) voidsetOauthAudience(String oauthAudience) voidsetOauthCredentialsUrl(URL oauthCredentialsUrl) voidsetOauthIssuerUrl(URL oauthIssuerUrl) voidsetServiceUrl(@Nullable String serviceUrl) voidsetSslProvider(String sslProvider) Defaults to default JVM provider.voidsetTlsAllowInsecureConnection(Boolean tlsAllowInsecureConnection) voidsetTlsCertFilePath(String tlsCertFilePath) voidsetTlsCiphers(Set<String> tlsCiphers) voidsetTlsProtocols(Set<String> tlsProtocols) voidsetTlsTrustStorePassword(String tlsTrustStorePassword) voidsetTlsTrustStorePath(String tlsTrustStorePath) voidsetTlsVerifyHostname(Boolean tlsVerifyHostname) voidsetUseDeadLetterQueue(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.Methods inherited from class io.micronaut.pulsar.config.AbstractPulsarConfiguration
getConfig
-
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- EnvironmentserviceUrlProvider- Pulsars service URL provider
-
-
Method Details
-
getIoThreads
- Specified by:
getIoThreadsin interfacePulsarClientConfiguration- Returns:
- Number of threads to allow for Pulsar library.
-
setIoThreads
- Parameters:
ioThreads- Number of threads to use with read operations
-
getListenerThreads
- Specified by:
getListenerThreadsin interfacePulsarClientConfiguration- Returns:
- Number of threads to allow for listeners from IO threads defined for Pulsar library
-
setListenerThreads
- Parameters:
listenerThreads- Number of threads to use with message example.java.listeners.
-
setAuthenticationJwt
-
getSslProvider
- Specified by:
getSslProviderin interfacePulsarClientConfiguration- Returns:
- SSL provider if any for Pulsar to client communication encryption
-
setTlsTrustStorePath
-
getTlsTrustStorePath
- Specified by:
getTlsTrustStorePathin interfacePulsarClientConfiguration
-
setTlsTrustStorePassword
-
getTlsTrustStorePassword
- Specified by:
getTlsTrustStorePasswordin interfacePulsarClientConfiguration- Returns:
- trust store password if any, trust stores don't contain any sensitive information but often work better with password in Java context.
-
setTlsCertFilePath
-
getTlsCertFilePath
- Specified by:
getTlsCertFilePathin interfacePulsarClientConfiguration- Returns:
- TLS certificate file path if any for TLS communication between Pulsar and clients.
-
setTlsVerifyHostname
-
getTlsVerifyHostname
Description copied from interface:PulsarClientConfigurationUseful in development environment for using with local host or such.- Specified by:
getTlsVerifyHostnamein interfacePulsarClientConfiguration- Returns:
- Whether to verify TLS certificate host or not.
-
setTlsAllowInsecureConnection
-
getTlsAllowInsecureConnection
- Specified by:
getTlsAllowInsecureConnectionin interfacePulsarClientConfiguration- Returns:
- Allow insecure connection when TLS certificate is set or not.
-
setTlsCiphers
-
getTlsCiphers
Description copied from interface:PulsarClientConfigurationCiphers like TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256.- Specified by:
getTlsCiphersin interfacePulsarClientConfiguration- Returns:
- Permitted ciphers for TLS.
-
setTlsProtocols
-
getTlsProtocols
Description copied from interface:PulsarClientConfigurationProtocols like TLSv1.3, TLSv1.2.- Specified by:
getTlsProtocolsin interfacePulsarClientConfiguration- Returns:
- Permitted protocols for TLS.
-
setSslProvider
Defaults to default JVM provider.- Parameters:
sslProvider- The name of the security provider used for SSL connections.
-
getServiceUrl
- Specified by:
getServiceUrlin interfacePulsarClientConfiguration- Returns:
- Apache Pulsar cluster address (IP or domain or hostname + port)
-
setServiceUrl
- Parameters:
serviceUrl- URL to Pulsar cluster
-
getServiceUrlProvider
Description copied from interface:PulsarClientConfigurationOptional provider for Pulsar services URL.- Specified by:
getServiceUrlProviderin interfacePulsarClientConfiguration- Returns:
- Optional bean for fetching Pulsar services URLs
-
getAuthentication
public org.apache.pulsar.client.api.Authentication getAuthentication()- Specified by:
getAuthenticationin interfacePulsarClientConfiguration- Returns:
- Authentication method for pulsar clients
-
getOauthAudience
Must be set for usage with the OAuth2 authentication.- Returns:
- String representing client application willing to listen to
-
setOauthAudience
- Parameters:
oauthAudience- OAuth2 audience
-
getOauthCredentialsUrl
-
setOauthCredentialsUrl
- Parameters:
oauthCredentialsUrl- URL or a path to a file containing client id, client secret, and such for OAuth2 client application.
-
getOauthIssuerUrl
-
setOauthIssuerUrl
- Parameters:
oauthIssuerUrl- URL of the OAuth2 Token issuer
-
getUseDeadLetterQueue
-
setUseDeadLetterQueue
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).#useDeadLetterQueuemust be enabled or else this value is ignored.- Parameters:
defaultMaxRetryDlq- Default max number of retries before sending message to DLQ for all consumers.
-
getDefaultTenant
Description copied from interface:PulsarClientConfigurationUseful for avoiding hard coding tenant name into every annotation value for producers, consumers, or readers.- Specified by:
getDefaultTenantin interfacePulsarClientConfiguration- Returns:
- Default tenant name if any.
-
setDefaultTenant
Use in combination with ${tenant} placeholder inPulsarConsumer.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.
-