Kafka stream:有没有办法在写入另一个主题时忽略主题分区中的特定偏移量
Kafka stream : Is there a way to ignore specific offsets in a topic partition while writing to another topic
背景:我在生成 prod 主题时使用了错误的 avro 架构注册表,结果由于架构错误的消息导致 kafka 连接中断 id.So 作为恢复计划,我们想将消息复制到将 prod 主题添加到测试主题,然后将好的消息写入 hdfs.But 我们在从 prod topic.Is 读取时遇到某些偏移量具有错误模式 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
{代码}
您可以更改反序列化异常处理程序以跳过文档中描述的那些记录:https://docs.confluent.io/current/streams/faq.html#handling-corrupted-records-and-deserialization-errors-poison-pill-records
即你在配置中通过参数default.deserialization.exception.handler
设置了LogAndContinueExceptionHandler
。
背景:我在生成 prod 主题时使用了错误的 avro 架构注册表,结果由于架构错误的消息导致 kafka 连接中断 id.So 作为恢复计划,我们想将消息复制到将 prod 主题添加到测试主题,然后将好的消息写入 hdfs.But 我们在从 prod topic.Is 读取时遇到某些偏移量具有错误模式 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
{代码}
您可以更改反序列化异常处理程序以跳过文档中描述的那些记录:https://docs.confluent.io/current/streams/faq.html#handling-corrupted-records-and-deserialization-errors-poison-pill-records
即你在配置中通过参数default.deserialization.exception.handler
设置了LogAndContinueExceptionHandler
。