Kafka流:有没有办法在写入另一个主题时忽略主题分区中的特定偏移

时间:2018-05-15 17:51:31

标签: apache-kafka apache-kafka-streams apache-kafka-connect

背景:我在生成prod主题时使用了错误的avro架构注册表,因此kafka连接由于具有错误架构ID的消息而关闭。因此,作为恢复计划,我们希望将prod主题中的消息复制到一个测试主题,然后将好消息写入hdfs.But我们正面临着从prod主题读取时具有错误模式ID的某些偏移的问题。有没有办法在写入另一个主题时忽略这些偏移。

 Exception in thread "StreamThread-1" 
 org.apache.kafka.streams.errors.StreamsException: Failed to deserialize value 
 for record. topic=xxxx, partition=9, offset=1259032
  Caused by: org.apache.kafka.common.errors.SerializationException: Error 
  retrieving Avro schema for id 600
  Caused by: 

  io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: 
   Schema not found io.confluent.rest.exceptions.RestNotFoundException: Schema not found
  io.confluent.rest.exceptions.RestNotFoundException: Schema not found

{代码}

1 个答案:

答案 0 :(得分:0)

您可以更改反序列化异常处理程序以跳过文档中描述的那些记录:https://docs.confluent.io/current/streams/faq.html#handling-corrupted-records-and-deserialization-errors-poison-pill-records

即,您通过参数LogAndContinueExceptionHandler在配置中设置default.deserialization.exception.handler

相关问题