task/engine/src/main/java/io/knotx/fragments/task/engine/FragmentsEngine.java
/**
   * Processes fragment events asynchronously.
   *
   * @param fragments list of fragment events with assigned {@code Task}
   * @return asynchronous response containing processed list of fragment events returned in the same
   * order as the original list
   */
Processes fragment events asynchronously.
@param fragments list of fragment events with assigned  Task
@return asynchronous response containing processed list of fragment events returned in the same
order as the original list
Processes fragment events asynchronously . @param fragments list of fragment events with assigned Task @return asynchronous response containing processed list of fragment events returned in the same order as the original list
public Single<List<FragmentEvent>> execute(List<FragmentEventContextTaskAware> fragments) {
    return Flowable.just(fragments)
        .concatMap(Flowable::fromIterable)
        .map(fragmentCtx -> fragmentCtx
            .getTask()
            .getRootNode()
            .map(rootNode -> startTaskEngine(fragmentCtx, rootNode))
            .orElseGet(() -> Single.just(fragmentCtx.getFragmentEventContext().getFragmentEvent()))
        )
        .flatMap(Single::toFlowable)
        .reduce(new ArrayList<FragmentEvent>(), (list, item) -> {
          list.add(item);
          return list;
        })
        .map(list -> incomingOrder(list, fragments))
        .map(this::traceEngineResults);
  }
public Single < List < FragmentEvent > > execute ( List < FragmentEventContextTaskAware > fragments ) { return Flowable . just ( fragments ) . concatMap ( Flowable :: fromIterable ) . map ( fragmentCtx -> fragmentCtx . getTask ( ) . getRootNode ( ) . map ( rootNode -> startTaskEngine ( fragmentCtx , rootNode ) ) . orElseGet ( ( ) -> Single . just ( fragmentCtx . getFragmentEventContext ( ) . getFragmentEvent ( ) ) ) ) . flatMap ( Single :: toFlowable ) . reduce ( new ArrayList < FragmentEvent > ( ) , ( list , item ) -> { list . add ( item ) ; return list ; } ) . map ( list -> incomingOrder ( list , fragments ) ) . map ( this :: traceEngineResults ) ; }
Processes fragment events asynchronously.
Processes fragment events asynchronously .