Class ScriptingTransformation<R extends org.apache.kafka.connect.connector.ConnectRecord<R>>

java.lang.Object
io.debezium.transforms.ScriptingTransformation<R>
Type Parameters:
R - the subtype of ConnectRecord on which this transformation will operate
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.kafka.common.Configurable, org.apache.kafka.connect.transforms.Transformation<R>
Direct Known Subclasses:
ContentBasedRouter, Filter

@Incubating public abstract class ScriptingTransformation<R extends org.apache.kafka.connect.connector.ConnectRecord<R>> extends Object implements org.apache.kafka.connect.transforms.Transformation<R>
This is a base class for any SMT using scripting languages. Current implementation supports only JSR223 scripting languages.

The SMT will instantiate an scripting engine encapsulated in Engine interface in configure phase. It will try to pre-parse the expression if it is allowed by the engine and than the expression is evaluated for every record incoming.

The engine will extract key, value and its schemas and will inject them as variables into the engine. The mapping is unique for each expression language.

Author:
Jiri Pechanec
  • Field Details

  • Constructor Details

    • ScriptingTransformation

      public ScriptingTransformation()
  • Method Details

    • configure

      public void configure(Map<String,?> configs)
      Specified by:
      configure in interface org.apache.kafka.common.Configurable
    • apply

      public R apply(R record)
      Specified by:
      apply in interface org.apache.kafka.connect.transforms.Transformation<R extends org.apache.kafka.connect.connector.ConnectRecord<R>>
    • doApply

      protected abstract R doApply(R record)
    • expressionField

      protected abstract Field expressionField()
    • config

      public org.apache.kafka.common.config.ConfigDef config()
      Specified by:
      config in interface org.apache.kafka.connect.transforms.Transformation<R extends org.apache.kafka.connect.connector.ConnectRecord<R>>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.apache.kafka.connect.transforms.Transformation<R extends org.apache.kafka.connect.connector.ConnectRecord<R>>