protected List<Record> processMessage(String messageId, Object message) throws StageException {
   List<Record> records = new ArrayList<>();
   if (dataFormat == DataFormat.AVRO) {
     try (DataParser parser = parserFactory.getParser(messageId, (byte[]) message)) {
       Record record = parser.parse();
       if (record != null) {
         records.add(record);
       }
     } catch (IOException | DataParserException ex) {
       LOG.debug("Got exception: '{}'", ex, ex);
       handleException(messageId, ex);
     }
   } else {
     try (DataParser parser = parserFactory.getParser(messageId, String.valueOf(message))) {
       Record record = parser.parse();
       while (record != null) {
         records.add(record);
         record = parser.parse();
       }
     } catch (IOException | DataParserException ex) {
       LOG.debug("Got exception: '{}'", ex, ex);
       handleException(messageId, ex);
     }
   }
   if (produceSingleRecordPerMessage) {
     List<Field> list = new ArrayList<>();
     for (Record record : records) {
       list.add(record.get());
     }
     Record record = records.get(0);
     record.set(Field.create(list));
     records.clear();
     records.add(record);
   }
   return records;
 }
 protected List<Record> processKafkaMessage(String messageId, byte[] payload)
     throws StageException {
   List<Record> records = new ArrayList<>();
   try (DataParser parser = parserFactory.getParser(messageId, payload)) {
     Record record = parser.parse();
     while (record != null) {
       records.add(record);
       record = parser.parse();
     }
   } catch (IOException | DataParserException ex) {
     handleException(messageId, ex);
   }
   if (produceSingleRecordPerMessage) {
     List<Field> list = new ArrayList<>();
     for (Record record : records) {
       list.add(record.get());
     }
     Record record = records.get(0);
     record.set(Field.create(list));
     records.clear();
     records.add(record);
   }
   return records;
 }