Recordparser never hit exceptionHandler

Skip to first unread message

hong qiu

Jun 30, 2022, 2:56:04 AMJun 30
to vert.x
Hi guys,

I am using Recordparser in delimiter mode to parse a readsteram. The stream is like id;content;id;content;  and my code is like: 

Future<Void> startToWrite(RecordParser parser) {
Promise<Void> jobDone = Promise.promise();
parser.exceptionHandler(err -> {;
.handler(buffer -> {
      getId(parser, buffer, jobDone);
      // getContent is inisde getId, then getId again in recursive
return jobDone.future();

1. From the book exmaple,  it uses recursive call to parse the content. Is there a better way to do it?
2. The parser is wrapped inside a future method. I want to give a promise.complete once it reaches end. But looks I can't reach the end, somehow parser.handle detects the end and stop the recursive. It there a way I can tell if it reachs end?
3. never throws to exceptionHandler, can you explain a bit or give anexample how to reach there?

Reply all
Reply to author
0 new messages