I was thinking about how to rewrite an old (2009) WCF middle-tier service, and have been thinking about George Tsiokos's recent TPL vs. RxNet post.
I think a middle-tier service is perfect to illustrate how I see the strengths and weaknesses of these two.  Specifically the scenario:

Complex Middle-Tier:  Startup vs. Message Handling

TPL might be great for startup tasks.  There is one 'global' task, Initialize, that has many sequences and chunks (in TPL these could be child tasks) that can have different degrees of parallelization.  It also requires global 'command and control' and 'top-down' composition and error handling (a type of event correlation).  If any critical part of startup fails then tear-down the service (cancel outstanding parallel tasks) and exit the service quickly.  So global handling and command-control programming style (root of the call hierarchy has all control).

Once everything is initialized you want bottom-up event correlation and error handling.  The function at the top of the callstack has no control (usually a WCF operation or I/O completion callback).  You only want global state to be touched when absolutely necessary, not touched by ignorable infrastructure errors, and not by errors that are ignorable according to business rules.

Startup, large complex top-down composable work:
TPL

Streams, composable business logic (streams that include error/end):
RxNet

With .NET 5 the TPL dataflow libraries might change things again, but for now I much prefer RxNet for composing and routing 'messages' between layers.  We recently used it in a project and when you have to correctly handle error scenarios it shines.  Imagine a WCF callback for a business operation that is completely async, where business logic has to fire if the notification fails (delivery of the data to the client).  The code isn't pretty in either case, but is better and can be handled at the right level of the lego blocks with RxNet.
0

Add a comment

'better together' for Visual Studio + Windows is over
'better together' for Visual Studio + Windows is over
Reopen an IE tab in Chrome using chrome2:// protocol
Reopen an IE tab in Chrome using chrome2:// protocol
To see more...
To see more...
Input Director & Windows Firewall
Input Director & Windows Firewall
Mid-Range RAID
Mid-Range RAID
My Google Apps
HTA on Windows RT might be interesting
HTA on Windows RT might be interesting
Technology and Platform Migration
Technology and Platform Migration
Visual Studio 2012 publish to file system - fails silently
Visual Studio 2012 publish to file system - fails silently
1
VS 2012 - No 'compare' command with pending merge
VS 2012 - No 'compare' command with pending merge
1
Chrome cmd line flag to allow mixed content in HTTPS pages
Chrome cmd line flag to allow mixed content in HTTPS pages
polygon in SQL Server 2008: compute the angle of the first side of the polygon
polygon in SQL Server 2008: compute the angle of the first side of the polygon
DOS tricks by yzorg, part 2
DOS tricks by yzorg, part 2
don't need to install .NET 3.5 for Metro UI Tweaker
don't need to install .NET 3.5 for Metro UI Tweaker
Greenshot on Windows 8 (.NET 4.5)
Greenshot on Windows 8 (.NET 4.5)
A look at ReactiveUI
A look at ReactiveUI
Middle-Tie​r: TPL and/or RxNet
Middle-Tie​r: TPL and/or RxNet
mandatory DOS trick - %date:~10,4%%date:~4,2%%date:~7,2%
mandatory DOS trick - %date:~10,4%%date:~4,2%%date:~7,2%
2
Round-Up
Round-Up
robocopy /MT for Windows XP: RichCopy
robocopy /MT for Windows XP: RichCopy
1
StreamBase annoyance for today
x-platform, huge performance from LMAX, Azul
x-platform, huge performance from LMAX, Azul
TopShelf and NuGet
TopShelf and NuGet
OData back-end code example
OData back-end code example
Enable and Disable monitor displays with Sikuli
blog 'Hello World' from yzorgsoft
blog 'Hello World' from yzorgsoft
Blog Archive
Contributors
Contributors
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.