Class SimpleFromAvroTransformer

All Implemented Interfaces:
Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, InitializingBean, ApplicationContextAware, ExpressionCapable, NamedComponent, GenericTransformer<Message<?>,Message<?>>, Transformer

public class SimpleFromAvroTransformer extends AbstractTransformer implements BeanClassLoaderAware
An Apache Avro transformer to create generated SpecificRecord objects from byte[].
Since:
5.2
Author:
Gary Russell, Artem Bilan
  • Constructor Details

    • SimpleFromAvroTransformer

      public SimpleFromAvroTransformer(Class<? extends org.apache.avro.specific.SpecificRecord> defaultType)
      Construct an instance with the supplied default type to create.
      Parameters:
      defaultType - the type.
  • Method Details

    • setBeanClassLoader

      public void setBeanClassLoader(ClassLoader classLoader)
      Specified by:
      setBeanClassLoader in interface BeanClassLoaderAware
    • typeExpression

      public SimpleFromAvroTransformer typeExpression(Expression expression)
      Set the expression to evaluate against the message to determine the type. Default headers['avro_type'].
      Parameters:
      expression - the expression.
      Returns:
      the transformer
    • typeExpression

      public SimpleFromAvroTransformer typeExpression(String expression)
      Set the expression to evaluate against the message to determine the type id. Default headers['avro_type'].
      Parameters:
      expression - the expression.
      Returns:
      the transformer
    • setTypeExpression

      public void setTypeExpression(Expression expression)
      Set the expression to evaluate against the message to determine the type. Default headers['avro_type'].
      Parameters:
      expression - the expression.
    • setTypeExpressionString

      public void setTypeExpressionString(String expression)
      Set the expression to evaluate against the message to determine the type id. Default headers['avro_type'].
      Parameters:
      expression - the expression.
    • onInit

      protected void onInit()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class IntegrationObjectSupport
    • doTransform

      protected Object doTransform(Message<?> message)
      Description copied from class: AbstractTransformer
      Subclasses must implement this method to provide the transformation logic. If the return value is itself a Message, it will be used as the result. Otherwise, any non-null return value will be used as the payload of the result Message.
      Specified by:
      doTransform in class AbstractTransformer
      Parameters:
      message - The message.
      Returns:
      The result of the transformation.