Need to run in parallel way with Uni in mutiny

  Kiến thức lập trình
  public void initialize(@Observes StartupEvent ev) {
    UniJoin.Builder<Integer> builder = Uni.join().builder();

    Stream.of(1,2,3,4).forEach(r -> {
      builder.add(consultrecord(r));
    });

    Uni<List<Integer>> all = builder.joinAll().usingConcurrencyOf(10).andFailFast();

    System.out.println("FINISH");

  }

  public Uni<Integer> consultrecord (Integer input) {
    try {
      System.out.println("PRUEBA DE TEXT");
      Thread.sleep(5000);
    } catch (InterruptedException e) {
      return Uni.createFrom().failure(e);
    }
    return Uni.createFrom().item(input);
  }


I need to run in parallel way but i see run one to one the 4 four elements and i need to run all in the same time

how to run uni in parallel way

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT