To support this in your parser, you should:
@Override public Optional<MessageParserResult<JSONObject>> parseOptionalResult(byte[] rawMessage)
@Override public List<JSONObject> parse(byte[] rawMessage) { Optional<MessageParserResult<JSONObject>> resultOptional = parseOptionalResult(rawMessage); if (!resultOptional.isPresent()) { return Collections.EMPTY_LIST; } Map<Object,Throwable> errors = resultOptional.get().getMessageThrowables(); if (!errors.isEmpty()) { throw new RuntimeException(errors.entrySet().iterator().next().getValue()); } return resultOptional.get().getMessages(); }
You may want to govern treating the incoming buffer as multiline or not by adding a configuration option for your parser, such as "multiline":"true"|"false"
See the org.apache.metron.parsers.GrokParser for an example of this implementation.
The Metron system itself will call the new parseOptionalResult method during processing. The default implementation in the interface handles backwards compatability with previous implementations.