Kafka -- Avro + Kafka Native API
Schema
1 | { |
编译Schema
1 | mvn clean compile |
自定义序列化器
1 | public class StockSerializer implements Serializer<Stock> { |
自定义反序列化器
1 | public class StockDeserializer implements Deserializer<Stock> { |
发送消息
1 | List<Stock> stocks = Lists.newArrayList(); |
消费消息
1 | Properties props = new Properties(); |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.