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:
io.debezium.metadata.ConfigDescriptor, Closeable, AutoCloseable, org.apache.kafka.common.Configurable, org.apache.kafka.connect.components.ConnectPlugin, org.apache.kafka.connect.components.Versioned, 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>, org.apache.kafka.connect.components.Versioned, io.debezium.metadata.ConfigDescriptor
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

    • LOGGER

      private final org.slf4j.Logger LOGGER
    • JAVAX_SCRIPT_ENGINE_PREFIX

      private static final String JAVAX_SCRIPT_ENGINE_PREFIX
      See Also:
    • WASM_ENGINE_PREFIX

      private static final String WASM_ENGINE_PREFIX
      See Also:
    • GRAAL_JS_ENGINE

      private static final String GRAAL_JS_ENGINE
      See Also:
    • CHICORY_ENGINE

      public static final String CHICORY_ENGINE
      See Also:
    • CHICORY_INTERPRETER_ENGINE

      public static final String CHICORY_INTERPRETER_ENGINE
      See Also:
    • TOPIC_REGEX

      private static final io.debezium.config.Field TOPIC_REGEX
    • LANGUAGE

      public static final io.debezium.config.Field LANGUAGE
    • NULL_HANDLING

      public static final io.debezium.config.Field NULL_HANDLING
    • engine

      protected Engine engine
    • nullHandling

    • topicPattern

      private Pattern topicPattern
  • 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 io.debezium.config.Field expressionField()
    • config

      public org.apache.kafka.common.config.ConfigDef config()
      Specified by:
      config in interface org.apache.kafka.connect.components.ConnectPlugin
    • 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>>
    • version

      public String version()
      Specified by:
      version in interface org.apache.kafka.connect.transforms.Transformation<R extends org.apache.kafka.connect.connector.ConnectRecord<R>>
      Specified by:
      version in interface org.apache.kafka.connect.components.Versioned
    • getConfigFields

      public io.debezium.config.Field.Set getConfigFields()
      Specified by:
      getConfigFields in interface io.debezium.metadata.ConfigDescriptor