Record Class AvroConverterConfiguration
java.lang.Object
java.lang.Record
org.axonframework.conversion.avro.AvroConverterConfiguration
- Record Components:
strategies- converter strategies to support different representation of objects (SpecificRecordBase, Avro4K).includeDefaultAvroConverterStrategies- flag to include the default strategies.schemaStore- schema store to resolve Avro schemas.schemaIncompatibilityChecker- schema incompatibility checker.avroConverterStrategyConfiguration- configuration for Avro converter strategy.
public record AvroConverterConfiguration(@Nonnull List<AvroConverterStrategy> strategies, boolean includeDefaultAvroConverterStrategies, @Nonnull org.apache.avro.message.SchemaStore schemaStore, @Nonnull SchemaIncompatibilityChecker schemaIncompatibilityChecker, @Nonnull AvroConverterStrategyConfiguration avroConverterStrategyConfiguration)
extends Record
Configuration for the AvroConverter.
- Since:
- 5.0.0
- Author:
- Simon Zambrovski, Jan Galinski
-
Constructor Summary
ConstructorsConstructorDescriptionAvroConverterConfiguration(List<AvroConverterStrategy> strategies, boolean includeDefaultAvroConverterStrategies, org.apache.avro.message.SchemaStore schemaStore, SchemaIncompatibilityChecker schemaIncompatibilityChecker, AvroConverterStrategyConfiguration avroConverterStrategyConfiguration) Constructor validating that required values are provided.AvroConverterConfiguration(org.apache.avro.message.SchemaStore schemaStore) Compact constructor, using provided schema store, default strategies, performing compatibility checks but not reporting schemas in stack traces on any conversion errors. -
Method Summary
Modifier and TypeMethodDescriptionaddConverterStrategy(AvroConverterStrategy strategy) Returns a new configuration with an additional Avro converter strategy.Returns the value of theavroConverterStrategyConfigurationrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theincludeDefaultAvroConverterStrategiesrecord component.includeDefaultAvroConverterStrategies(boolean includeDefaultAvroConverterStrategies) Returns new configuration using (or not) default Avro converter strategies, based on the provided flag.includeSchemasInStackTraces(boolean includeSchemasInStackTraces) Creates a new configuration reporting (or not) reader and writer schema in stack traces on errors, based on the provided flag.performAvroCompatibilityCheck(boolean performAvroCompatibilityCheck) Creates a new configuration performing (or not) compatibility checks, based on the provided flag.Returns the value of theschemaIncompatibilityCheckerrecord component.schemaIncompatibilityChecker(SchemaIncompatibilityChecker schemaIncompatibilityChecker) Creates a new configuration using provided schema incompatibility checker.org.apache.avro.message.SchemaStoreReturns the value of theschemaStorerecord component.Returns the value of thestrategiesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
AvroConverterConfiguration
public AvroConverterConfiguration(@Nonnull List<AvroConverterStrategy> strategies, boolean includeDefaultAvroConverterStrategies, @Nonnull org.apache.avro.message.SchemaStore schemaStore, @Nonnull SchemaIncompatibilityChecker schemaIncompatibilityChecker, @Nonnull AvroConverterStrategyConfiguration avroConverterStrategyConfiguration) Constructor validating that required values are provided.- Parameters:
strategies- list of avro converter strategies, must not be null.includeDefaultAvroConverterStrategies- flag to include the default strategies.schemaStore- schema store to resolve Avro schemas.schemaIncompatibilityChecker- schema incompatibility checker.avroConverterStrategyConfiguration- configuration for Avro converter strategy.
-
AvroConverterConfiguration
public AvroConverterConfiguration(@Nonnull org.apache.avro.message.SchemaStore schemaStore) Compact constructor, using provided schema store, default strategies, performing compatibility checks but not reporting schemas in stack traces on any conversion errors.- Parameters:
schemaStore- schema store to use, must not be null.
-
-
Method Details
-
addConverterStrategy
Returns a new configuration with an additional Avro converter strategy.- Parameters:
strategy- provided strategy to use, for example the one compatible with Avro4K data classes.- Returns:
- configuration instance.
-
includeDefaultAvroConverterStrategies
public AvroConverterConfiguration includeDefaultAvroConverterStrategies(boolean includeDefaultAvroConverterStrategies) Returns new configuration using (or not) default Avro converter strategies, based on the provided flag.Please note, that at least one Avro Strategy is required for the converter. If you intend not to use default strategies, add your customer strategy using
addConverterStrategy(AvroConverterStrategy)first.- Parameters:
includeDefaultAvroConverterStrategies- flag to use default strategy (`true`) or not to use it.- Returns:
- new configuration.
-
schemaIncompatibilityChecker
public AvroConverterConfiguration schemaIncompatibilityChecker(@Nonnull SchemaIncompatibilityChecker schemaIncompatibilityChecker) Creates a new configuration using provided schema incompatibility checker.- Parameters:
schemaIncompatibilityChecker- instance responsible for schema compatibility checks.- Returns:
- new configuration.
-
includeSchemasInStackTraces
Creates a new configuration reporting (or not) reader and writer schema in stack traces on errors, based on the provided flag.- Parameters:
includeSchemasInStackTraces- flag controlling if the schema reporting is included in stack traces.- Returns:
- new configuration.
-
performAvroCompatibilityCheck
public AvroConverterConfiguration performAvroCompatibilityCheck(boolean performAvroCompatibilityCheck) Creates a new configuration performing (or not) compatibility checks, based on the provided flag.- Parameters:
performAvroCompatibilityCheck- flag controlling if the check should be performed prio conversion.- Returns:
- new configuration.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
strategies
Returns the value of thestrategiesrecord component.- Returns:
- the value of the
strategiesrecord component
-
includeDefaultAvroConverterStrategies
public boolean includeDefaultAvroConverterStrategies()Returns the value of theincludeDefaultAvroConverterStrategiesrecord component.- Returns:
- the value of the
includeDefaultAvroConverterStrategiesrecord component
-
schemaStore
@Nonnull public org.apache.avro.message.SchemaStore schemaStore()Returns the value of theschemaStorerecord component.- Returns:
- the value of the
schemaStorerecord component
-
schemaIncompatibilityChecker
Returns the value of theschemaIncompatibilityCheckerrecord component.- Returns:
- the value of the
schemaIncompatibilityCheckerrecord component
-
avroConverterStrategyConfiguration
Returns the value of theavroConverterStrategyConfigurationrecord component.- Returns:
- the value of the
avroConverterStrategyConfigurationrecord component
-