public void start(Future<Void> fut) { Arrays.asList(publishers) .forEach( s -> vertx.setPeriodic( sampleFrequence, event -> { System.out.println("sending message to kafka:" + kafkaPort); executor.submit( () -> { producer.send( topic, "message", createJson(s, 1, 15).getJsonObject(0).encode()); }); })); fut.complete(); }