@Override public StringRecord processRecord(Record<User> record) throws RecordProcessingException { User user = record.getPayload(); XContentBuilder builder; try { builder = XContentFactory.jsonBuilder() .startObject() .field("id", user.getId()) .field("age", user.getAge()) .field("gender", user.getGender()) .endObject(); return new StringRecord(record.getHeader(), builder.string()); } catch (IOException e) { throw new RecordProcessingException("Failed to map record", e); } }
@Override public Record processRecord(final Record record) { for (long number : numbers) { if (record.getHeader().getNumber() == number) { return null; } } return record; }