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 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

      public AvroConverterConfiguration addConverterStrategy(@Nonnull AvroConverterStrategy strategy)
      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

      public AvroConverterConfiguration includeSchemasInStackTraces(boolean 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • strategies

      @Nonnull public List<AvroConverterStrategy> strategies()
      Returns the value of the strategies record component.
      Returns:
      the value of the strategies record component
    • includeDefaultAvroConverterStrategies

      public boolean includeDefaultAvroConverterStrategies()
      Returns the value of the includeDefaultAvroConverterStrategies record component.
      Returns:
      the value of the includeDefaultAvroConverterStrategies record component
    • schemaStore

      @Nonnull public org.apache.avro.message.SchemaStore schemaStore()
      Returns the value of the schemaStore record component.
      Returns:
      the value of the schemaStore record component
    • schemaIncompatibilityChecker

      @Nonnull public SchemaIncompatibilityChecker schemaIncompatibilityChecker()
      Returns the value of the schemaIncompatibilityChecker record component.
      Returns:
      the value of the schemaIncompatibilityChecker record component
    • avroConverterStrategyConfiguration

      @Nonnull public AvroConverterStrategyConfiguration avroConverterStrategyConfiguration()
      Returns the value of the avroConverterStrategyConfiguration record component.
      Returns:
      the value of the avroConverterStrategyConfiguration record component