Class SchemaResolverConfig

java.lang.Object
io.apicurio.registry.resolver.config.AbstractConfig
io.apicurio.registry.resolver.config.SchemaResolverConfig

public class SchemaResolverConfig extends AbstractConfig
Contains the DefaultSchemaResolver configuration properties.
  • Field Details

    • ARTIFACT_RESOLVER_STRATEGY

      public static final String ARTIFACT_RESOLVER_STRATEGY
      Fully qualified Java classname of a class that implements ArtifactReferenceResolverStrategy and is responsible for mapping between the Record being resolved and an artifactId. For example there is a strategy to use the topic name as the schema's artifactId. Only used by SchemaResolver.resolveSchema(io.apicurio.registry.resolver.data.Record)
      See Also:
    • ARTIFACT_RESOLVER_STRATEGY_DEFAULT

      public static final String ARTIFACT_RESOLVER_STRATEGY_DEFAULT
      Uses the ArtifactReference available for each record. Requires Metadata.artifactReference() to be set. Note this default artifact resolver strategy differs in behavior from the classic Kafka serdes ArtifactResolverStrategy
    • AUTO_REGISTER_ARTIFACT

      public static final String AUTO_REGISTER_ARTIFACT
      Optional, boolean to indicate whether serializer classes should attempt to create an artifact in the registry. Note: JsonSchema serializer does not support this feature yet.
      See Also:
    • AUTO_REGISTER_ARTIFACT_DEFAULT

      public static final boolean AUTO_REGISTER_ARTIFACT_DEFAULT
      See Also:
    • AUTO_REGISTER_ARTIFACT_IF_EXISTS

      public static final String AUTO_REGISTER_ARTIFACT_IF_EXISTS
      Optional, one of "IfExists" to indicate the behavior of the client when there is a conflict creating an artifact because the artifact already exists.
      See Also:
    • AUTO_REGISTER_ARTIFACT_IF_EXISTS_DEFAULT

      public static final String AUTO_REGISTER_ARTIFACT_IF_EXISTS_DEFAULT
      See Also:
    • FIND_LATEST_ARTIFACT

      public static final String FIND_LATEST_ARTIFACT
      Optional, boolean to indicate whether serializer classes should attempt to find the latest artifact in the registry for the corresponding groupId/artifactId. GroupId and artifactId are configured either via ArtifactReferenceResolverStrategy or via config properties such as EXPLICIT_ARTIFACT_ID.
      See Also:
    • FIND_LATEST_ARTIFACT_DEFAULT

      public static final boolean FIND_LATEST_ARTIFACT_DEFAULT
      See Also:
    • CACHE_LATEST

      public static final String CACHE_LATEST
      If true, will cache schema lookups that either have `latest` or no version specified. Setting this to false will effectively disable caching for schema lookups that do not specify a version.
      See Also:
    • CACHE_LATEST_DEFAULT

      public static final boolean CACHE_LATEST_DEFAULT
      See Also:
    • FAULT_TOLERANT_REFRESH

      public static final String FAULT_TOLERANT_REFRESH
      If true, will log exceptions instead of throwing them when an error occurs trying to refresh a schema in the cache. This is useful for production situations where a stale schema is better than completely failing schema resolution. Note that this will not impact trying of retries, as retries are attempted before this flag is considered.
      See Also:
    • FAULT_TOLERANT_REFRESH_DEFAULT

      public static final boolean FAULT_TOLERANT_REFRESH_DEFAULT
      See Also:
    • BACKGROUND_REFRESH_ENABLED

      public static final String BACKGROUND_REFRESH_ENABLED
      If true, enables background refresh of expired cache entries following the "stale-while-revalidate" pattern. When an entry expires and a stale value exists, the cache will return the stale value immediately (non-blocking) and trigger an asynchronous refresh in the background. This prevents latency spikes in high-concurrency scenarios where multiple threads would otherwise block waiting for cache refresh. If no stale value exists (first fetch), falls back to synchronous refresh behavior. This option complements FAULT_TOLERANT_REFRESH, which handles refresh failures rather than refresh latency.
      See Also:
    • BACKGROUND_REFRESH_ENABLED_DEFAULT

      public static final boolean BACKGROUND_REFRESH_ENABLED_DEFAULT
      See Also:
    • BACKGROUND_REFRESH_EXECUTOR_THREADS

      public static final String BACKGROUND_REFRESH_EXECUTOR_THREADS
      The number of threads in the background refresh executor pool. Only used when BACKGROUND_REFRESH_ENABLED is enabled. The executor uses a fixed thread pool with daemon threads to prevent blocking application shutdown. A value of 2-4 threads is typically sufficient for most workloads. Valid values are positive integers.
      See Also:
    • BACKGROUND_REFRESH_EXECUTOR_THREADS_DEFAULT

      public static final long BACKGROUND_REFRESH_EXECUTOR_THREADS_DEFAULT
      See Also:
    • BACKGROUND_REFRESH_TIMEOUT_MS

      public static final String BACKGROUND_REFRESH_TIMEOUT_MS
      The maximum time (in milliseconds) to wait for a background refresh operation to complete before timing out. Only used when BACKGROUND_REFRESH_ENABLED is enabled. If a background refresh exceeds this timeout, it will be interrupted and the stale value will continue to be served until the next refresh attempt. Valid values are positive integers.
      See Also:
    • BACKGROUND_REFRESH_TIMEOUT_MS_DEFAULT

      public static final long BACKGROUND_REFRESH_TIMEOUT_MS_DEFAULT
      See Also:
    • EXPLICIT_ARTIFACT_GROUP_ID

      public static final String EXPLICIT_ARTIFACT_GROUP_ID
      Only applicable for serializers Optional, set explicitly the groupId used for querying/creating an artifact. Overrides the groupId returned by the ArtifactReferenceResolverStrategy
      See Also:
    • EXPLICIT_ARTIFACT_ID

      public static final String EXPLICIT_ARTIFACT_ID
      Only applicable for serializers Optional, set explicitly the artifactId used for querying/creating an artifact. Overrides the artifactId returned by the ArtifactReferenceResolverStrategy
      See Also:
    • SCHEMA_LOCATION

      public static final String SCHEMA_LOCATION
      Only applicable for serializers Optional, set explicitly the schema location in the classpath for the schema to be used for serializing the data.
      See Also:
    • EXPLICIT_ARTIFACT_VERSION

      public static final String EXPLICIT_ARTIFACT_VERSION
      Only applicable for serializers Optional, set explicitly the version used for querying/creating an artifact. Overrides the version returned by the ArtifactReferenceResolverStrategy
      See Also:
    • REGISTRY_URL

      public static final String REGISTRY_URL
      The URL of the Apicurio Registry. Required when using any Apicurio Registry serde class (serializer or deserializer).
      See Also:
    • REGISTRY_URL_VERSION

      public static final String REGISTRY_URL_VERSION
      The API version implemented by the URL endpoint indicated by the 'apicurio.registry.url' property. This is typically not required because the Registry Client will auto-detect the endpoint version based on the URL itself. However, in case the URL is non-standard or being rewritten by a proxy, or some other odd circumstance, set the property to the API version such as "2" or "3". Use the major version only.
      See Also:
    • AUTH_TOKEN_ENDPOINT

      public static final String AUTH_TOKEN_ENDPOINT
      The URL of the Token Endpoint.
      See Also:
    • AUTH_CLIENT_ID

      public static final String AUTH_CLIENT_ID
      The Client Id of the Auth Service.
      See Also:
    • AUTH_CLIENT_SECRET

      public static final String AUTH_CLIENT_SECRET
      The Secret of the Auth Service.
      See Also:
    • AUTH_CLIENT_SCOPE

      public static final String AUTH_CLIENT_SCOPE
      The Scope of the Auth Service.
      See Also:
    • AUTH_USERNAME

      public static final String AUTH_USERNAME
      The Username of the Auth Service.
      See Also:
    • AUTH_PASSWORD

      public static final String AUTH_PASSWORD
      The Password of the Auth Service.
      See Also:
    • CHECK_PERIOD_MS

      public static final String CHECK_PERIOD_MS
      Indicates how long to cache artifacts before auto-eviction. If not included, the artifact will be fetched every time.
      See Also:
    • CHECK_PERIOD_MS_DEFAULT

      public static final long CHECK_PERIOD_MS_DEFAULT
      See Also:
    • RETRY_COUNT

      public static final String RETRY_COUNT
      If a schema can not be retrieved from the Registry, serdes may retry a number of times. This configuration option controls the number of retries before failing. Valid values are non-negative integers.
      See Also:
    • RETRY_COUNT_DEFAULT

      public static final long RETRY_COUNT_DEFAULT
      See Also:
    • RETRY_BACKOFF_MS

      public static final String RETRY_BACKOFF_MS
      If a schema can not be be retrieved from the Registry, serdes may retry a number of times. This configuration option controls the delay between the retry attempts, in milliseconds. Valid values are non-negative integers.
      See Also:
    • RETRY_BACKOFF_MS_DEFAULT

      public static final long RETRY_BACKOFF_MS_DEFAULT
      See Also:
    • DEREFERENCE_SCHEMA

      public static final String DEREFERENCE_SCHEMA
      Used to indicate the serdes to dereference the schema. This is used in two different situation, once the schema is registered, instructs the serdes to ask the server for the schema dereferenced. It is also used to instruct the serializer to dereference the schema before registering it Registry, but this is only supported for Avro.
      See Also:
    • DEREFERENCE_DEFAULT

      public static final boolean DEREFERENCE_DEFAULT
      See Also:
    • CANONICALIZE

      public static final String CANONICALIZE
      Used to indicate whether the schema resolver should canonicalize content when using content to lookup/search for an artifact version in the registry by content.
      See Also:
    • CANONICALIZE_DEFAULT

      public static final boolean CANONICALIZE_DEFAULT
      See Also:
    • TLS_TRUSTSTORE_LOCATION

      public static final String TLS_TRUSTSTORE_LOCATION
      The location of the trust store file for TLS/SSL connections. Can be a file path or a resource on the classpath. Used when connecting to a registry over HTTPS with custom certificates.
      See Also:
    • TLS_TRUSTSTORE_PASSWORD

      public static final String TLS_TRUSTSTORE_PASSWORD
      The password for the trust store file specified by TLS_TRUSTSTORE_LOCATION. Required when using JKS or PKCS12 trust stores. Not required for PEM certificates.
      See Also:
    • TLS_TRUSTSTORE_TYPE

      public static final String TLS_TRUSTSTORE_TYPE
      The type of trust store. Valid values are "JKS", "PKCS12" (or "P12"), and "PEM". Defaults to "JKS".
      See Also:
    • TLS_TRUSTSTORE_TYPE_DEFAULT

      public static final String TLS_TRUSTSTORE_TYPE_DEFAULT
      See Also:
    • TLS_CERTIFICATES

      public static final String TLS_CERTIFICATES
      PEM certificate configuration for TLS/SSL trust. This property accepts either:
      • Comma-separated list of PEM certificate file paths (e.g., "/path/to/cert1.pem,/path/to/cert2.pem")
      • PEM certificate content as a string (one or more certificates with -----BEGIN CERTIFICATE----- markers)
      An alternative to using TLS_TRUSTSTORE_LOCATION with a JKS file. When using this option, set TLS_TRUSTSTORE_TYPE to "PEM".

      The system automatically detects whether the value contains file paths or certificate content by checking for the presence of "-----BEGIN CERTIFICATE-----" markers.

      See Also:
    • TLS_TRUST_ALL

      public static final String TLS_TRUST_ALL
      If true, disables all SSL/TLS certificate verification. This is insecure and should only be used in development/testing environments. Defaults to false.
      See Also:
    • TLS_TRUST_ALL_DEFAULT

      public static final boolean TLS_TRUST_ALL_DEFAULT
      See Also:
    • TLS_VERIFY_HOST

      public static final String TLS_VERIFY_HOST
      If true, verifies that the hostname in the server certificate matches the server hostname. Defaults to true. Set to false only when necessary (e.g., when using IP addresses instead of hostnames).
      See Also:
    • TLS_VERIFY_HOST_DEFAULT

      public static final boolean TLS_VERIFY_HOST_DEFAULT
      See Also:
    • PROXY_HOST

      public static final String PROXY_HOST
      The HTTP/HTTPS proxy host for registry connections. Required when connecting through a proxy server. Can be a hostname or IP address.
      See Also:
    • PROXY_PORT

      public static final String PROXY_PORT
      The HTTP/HTTPS proxy port for registry connections. Required when PROXY_HOST is specified. Common proxy ports are 3128, 8080, or 8888.
      See Also:
    • PROXY_USERNAME

      public static final String PROXY_USERNAME
      Optional username for proxy authentication. Only required if the proxy server requires authentication.
      See Also:
    • PROXY_PASSWORD

      public static final String PROXY_PASSWORD
      Optional password for proxy authentication. Only required if the proxy server requires authentication and PROXY_USERNAME is specified.
      See Also:
    • VERTX_INSTANCE

      public static final String VERTX_INSTANCE
      Internal property key for storing a Vertx instance. This is not typically set via string properties but rather programmatically when creating the configuration. When provided, this Vertx instance will be used for HTTP client connections instead of creating a new instance.

      Recommended: Provide your own managed Vertx instance to ensure proper lifecycle management and resource cleanup.

      See Also:
    • HTTP_ADAPTER

      public static final String HTTP_ADAPTER
      The HTTP adapter to use for registry client connections. Valid values are:
      • "AUTO" - Automatically detect and use the best available adapter (default). Prefers Vert.x if available, falls back to JDK if not.
      • "VERTX" - Use the Vert.x HTTP adapter. Requires kiota-http-vertx dependency.
      • "JDK" - Use the JDK 11+ HttpClient adapter. Requires kiota-http-jdk dependency. Provides a lighter-weight option with no additional dependencies beyond the JDK.
      See Also:
    • HTTP_ADAPTER_DEFAULT

      public static final String HTTP_ADAPTER_DEFAULT
      See Also:
    • OTEL_ENABLED

      public static final String OTEL_ENABLED
      Whether to enable OpenTelemetry trace context propagation for HTTP requests to the Registry. When enabled, W3C trace context headers (traceparent, tracestate) will be injected into all outgoing requests.

      Requires the opentelemetry-api library to be on the classpath.

      See Also:
    • OTEL_ENABLED_DEFAULT

      public static final boolean OTEL_ENABLED_DEFAULT
      See Also:
    • USAGE_TELEMETRY_CLIENT_ID

      public static final String USAGE_TELEMETRY_CLIENT_ID
      Identifier for the client application, sent as X-Registry-Client-Id header on schema fetch requests. When set, the registry server records usage telemetry for this client.
      See Also:
  • Constructor Details

    • SchemaResolverConfig

      public SchemaResolverConfig()
    • SchemaResolverConfig

      public SchemaResolverConfig(Map<String,?> originals)
  • Method Details

    • getRegistryUrl

      public String getRegistryUrl()
    • getRegistryUrlVersion

      public String getRegistryUrlVersion()
    • getTokenEndpoint

      public String getTokenEndpoint()
    • getAuthClientId

      public String getAuthClientId()
    • getAuthClientSecret

      public String getAuthClientSecret()
    • getAuthClientScope

      public String getAuthClientScope()
    • getAuthUsername

      public String getAuthUsername()
    • getAuthPassword

      public String getAuthPassword()
    • getArtifactResolverStrategy

      public Object getArtifactResolverStrategy()
    • autoRegisterArtifact

      public boolean autoRegisterArtifact()
    • autoRegisterArtifactIfExists

      public String autoRegisterArtifactIfExists()
    • getCacheLatest

      public boolean getCacheLatest()
    • getFaultTolerantRefresh

      public boolean getFaultTolerantRefresh()
    • getBackgroundRefresh

      public boolean getBackgroundRefresh()
    • getBackgroundRefreshExecutorThreads

      public long getBackgroundRefreshExecutorThreads()
    • getBackgroundRefreshTimeout

      public Duration getBackgroundRefreshTimeout()
    • findLatest

      public boolean findLatest()
    • getCheckPeriod

      public Duration getCheckPeriod()
    • getRetryCount

      public long getRetryCount()
    • getRetryBackoff

      public Duration getRetryBackoff()
    • getExplicitArtifactGroupId

      public String getExplicitArtifactGroupId()
    • getExplicitArtifactId

      public String getExplicitArtifactId()
    • getExplicitSchemaLocation

      public String getExplicitSchemaLocation()
    • getExplicitArtifactVersion

      public String getExplicitArtifactVersion()
    • resolveDereferenced

      public boolean resolveDereferenced()
    • isCanonicalize

      public boolean isCanonicalize()
    • getTlsTruststoreLocation

      public String getTlsTruststoreLocation()
    • getTlsTruststorePassword

      public String getTlsTruststorePassword()
    • getTlsTruststoreType

      public String getTlsTruststoreType()
    • getTlsCertificates

      public String getTlsCertificates()
    • getTlsTrustAll

      public boolean getTlsTrustAll()
    • getTlsVerifyHost

      public boolean getTlsVerifyHost()
    • getProxyHost

      public String getProxyHost()
    • getProxyPort

      public Integer getProxyPort()
    • getProxyUsername

      public String getProxyUsername()
    • getProxyPassword

      public String getProxyPassword()
    • getVertx

      public io.vertx.core.Vertx getVertx()
      Returns the Vertx instance if one was provided in the configuration.

      This allows callers to provide their own managed Vertx instance instead of relying on automatically created instances. This is the recommended approach for production environments to ensure proper lifecycle management.

      Returns:
      the configured Vertx instance, or null if not provided
    • getHttpAdapter

      public String getHttpAdapter()
      Returns the HTTP adapter type to use for registry client connections.
      Returns:
      the HTTP adapter type string ("AUTO", "VERTX", or "JDK")
    • isOtelEnabled

      public boolean isOtelEnabled()
      Returns whether OpenTelemetry trace context propagation is enabled.
      Returns:
      true if OTel trace context propagation is enabled
    • getUsageTelemetryClientId

      public String getUsageTelemetryClientId()
    • getDefaults

      protected Map<String,?> getDefaults()
      Specified by:
      getDefaults in class AbstractConfig