コード例 #1
0
 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();
 }
コード例 #2
0
 @Override
 public void stop(Future<Void> stopFuture) throws Exception {
   producer.shutdown();
   stopFuture.complete();
 }