I want to run multiple rest calls with different output asynchronously. I am writing the code as
Future<Either<ViolationException, Products>> products = Future.of(() ->
validateProducts([INPUT])
);
Future<Either<DomainException, List<Category>>> categories = Future.of(() -> validateCategory([INPUT]));
Future<Seq<Either<? extends DomainException, ? extends Object>>> finalecall = Future.sequence(List.of(products, categories,..));
There are about 4 to 5 rest calls which I will make which I want to be asynchronous but since Future is generic and extending Object class, not finding any other way to achieve this.
Is there any way I can get result of all the rest calls which are of future, after all success or failure, I can use this