Class Jsr223Engine

  • All Implemented Interfaces:
    Engine
    Direct Known Subclasses:
    GraalJsEngine

    public class Jsr223Engine
    extends Object
    implements Engine
    An implementation of the expression language evaluator based on JSR 223 scripting languages. The expression receives variables to work with
    • key - key of the record
    • value - value of the record
    • keySchema - schema for key
    • valueSchema - schema for value
    Author:
    Jiri Pechanec
    • Constructor Detail

      • Jsr223Engine

        public Jsr223Engine()
    • Method Detail

      • configure

        public void configure​(String language,
                              String expression)
        Description copied from interface: Engine
        Pre-compiles the expression for repeated execution. The method is called once upon the engine initialization.
        Specified by:
        configure in interface Engine
      • configureEngine

        protected void configureEngine()
      • getBindings

        protected Bindings getBindings​(org.apache.kafka.connect.connector.ConnectRecord<?> record)
      • key

        protected Object key​(org.apache.kafka.connect.connector.ConnectRecord<?> record)
      • value

        protected Object value​(org.apache.kafka.connect.connector.ConnectRecord<?> record)
      • header

        protected RecordHeader header​(org.apache.kafka.connect.header.Header header)
      • headers

        protected Object headers​(org.apache.kafka.connect.connector.ConnectRecord<?> record)
      • doHeaders

        protected Map<String,​RecordHeader> doHeaders​(org.apache.kafka.connect.connector.ConnectRecord<?> record)
      • eval

        public <T> T eval​(org.apache.kafka.connect.connector.ConnectRecord<?> record,
                          Class<T> type)
        Description copied from interface: Engine
        Calculate a value out of the record.
        Specified by:
        eval in interface Engine
        Parameters:
        record - to be used
        Returns:
        result of calculation