简体   繁体   中英

How can i apply a filter in this avro schema using Apache Flink

Hello guys i'm deserializing an Avro Kafka message like this:

FlinkKafkaConsumer<String> consumer = new FlinkKafkaConsumer("conekta.public.person",
     new KafkaGenericAvroDeserializationSchema("http://localhost:8081"), kafkaProps);

the messagge i'm getting is like this:

{"before": null, "after": {"id": 257, "status": "c4ca4238a0"}, "source": {"version": "0.9.4.Final", "connector": "postgresql", "name": "conekta", "db": "testdb", "ts_usec": 1579909929965704, "txId": 5847, "lsn": 294339488688, "schema": "public", "table": "person", "snapshot": false, "last_snapshot_record": null, "xmin": null}, "op": "c", "ts_ms": 1579909930004}

{"before": null, "after": {"id": 258, "status": "c4ca4238a0"}, "source": {"version": "0.9.4.Final", "connector": "postgresql", "name": "conekta", "db": "testdb", "ts_usec": 1579910374459669, "txId": 5849, "lsn": 294473695272, "schema": "public", "table": "person", "snapshot": false, "last_snapshot_record": null, "xmin": null}, "op": "c", "ts_ms": 1579910374518}

How could i apply a filterto get all the records where the id is < 258 on my flink consumer.

I'm very new in Apache Flink.

Any help will be much appreciated.

Thanks!

您可以覆盖 KafkaGenericAvroDeserializationSchema 上的boolean isEndOfStream(GenericRecord nextElement)以在您希望流结束时返回 true。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM