@Override
protected boolean doProcess(Record inputRecord, InputStream in) throws IOException {
Record template = inputRecord.copy();
removeAttachments(template);
MappingIterator iter = reader.readValues(in);
try {
while (iter.hasNextValue()) {
Object rootNode = iter.nextValue();
incrementNumRecords();
LOG.trace("jsonObject: {}", rootNode);
Record outputRecord = template.copy();
outputRecord.put(Fields.ATTACHMENT_BODY, rootNode);
outputRecord.put(Fields.ATTACHMENT_MIME_TYPE, MIME_TYPE);
// pass record to next command in chain:
if (!getChild().process(outputRecord)) {
return false;
}
}
return true;
} finally {
iter.close();
}
}