Saturday, December 8, 2018

Difference Between MergeMap and ForkJoin

ForkJoin will return an array of responses when all requests have finished. 

ForkJoin operator faces some problems with delayed requests too. The order will be preserved but if one request is delayed all the others have to wait for its resolution.

Another issue with forkJoin() is related to the way it handles failed requests. If any of the executed requests fails it will fail for the whole collection. Instead of items we will receive first encountered exception.

MergeMap() executes requests in parallel and it is fault tolerant so we still display most of the posts even if some of the requests fail. Order is not maintained in MergeMap.

No comments:

Followers

Link