0

I am trying to use and understand Java8 CompletableFuture concept. Please help me to under if there is a way I can implement by below scenario.

Scenario Description: I have a Car repository and a user repository.

I have individual service like: getUserData (returns List) and getCarData (returns List) to fetch me the values.

Now I have created another repository called: CarBooking and it has a service called createNewBooking, which should accept List and List as input.

Is there any way that I can create a chained method using CompletableFuture which can combine these services/tasks to be triggered.

Like CompletableFuture.supplyAsync(this::getUserData).....

I am not able to understand how can I join another service and use first and second value to third service as BiConsumer.

Help is much appreciated.

Arka
  • 101
  • 1
  • 8
  • 1
    Does this answer your question? https://stackoverflow.com/a/42490017/4417924 – Jason Jul 25 '20 at 05:32
  • Thanks Jason. It does answer my question. I have applied the flow mentioned in that and it did work. – Arka Jul 25 '20 at 07:12

0 Answers0