Sory在配置中出错。我修复了它们,找到了将css转换为avro的方法。我有点修改 AvroEventSerializer 这条路:
AvroEventSerializer
public void write(Event event) throws IOException { if (dataFileWriter == null) { initialize(event); } String[] items = new String(event.getBody()).split(","); city.put("deviceID", Long.parseLong(items[0])); city.put("groupID", Long.parseLong(items[1])); city.put("timeCounter", Long.parseLong(items[2])); city.put("cityCityName", items[3]); city.put("cityStateCode", items[4]); city.put("sessionCount", Long.parseLong(items[5])); city.put("errorCount", Long.parseLong(items[6])); dataFileWriter.append(citi); }
这是 city 定义:
city
private GenericRecord city = null;
如果您知道更好的方法,请回复