Scala Kafka Streams自定义时间戳提取程序导致编译错误

时间:2018-06-01 15:16:48

标签: kafka-streams-scala

我创建了一个自定义时间提取器类,如此

class MyTimestampExtractor extends TimestampExtractor {
  override def extract(record: ConsumerRecord[Object, Object], previousTimestamp: java.lang.Long): java.lang.Long = {
    record.value() match {

      }
  }
}

但是这会导致编译错误

method extract overrides nothing.
Note: the super classes of class MyTimestampExtractor contain the following, non final members named extract:
def extract(x$1: org.apache.kafka.clients.consumer.ConsumerRecord[Object,Object],x$2: Long): Long
  override def extract(record: ConsumerRecord[Object, Object], previousTimestamp: java.lang.Long): java.lang.Long = {

我有一个Object和Long的import语句,如此

import java.lang.{Object, Long}

我尝试过的事情

  1. 将对象更改为java.lang.Object
  2. 将java.lang.Long更改为Long(这可能会发送长Scala而不是java长)
  3. 将ConsumerRecord更改为org.apache.kafka.clients.consumer.ConsumerRecord
  4. 使用prev而不是previousTimestamp
  5. 使用包名称的完全限定类型
  6. 似乎对编译器没有任何作用。

0 个答案:

没有答案