TPL Dataflow by Example
Minimum price
Suggested price

TPL Dataflow by Example

Dataflow and Reactive Programming in .Net

About the Book

The TPL Dataflow Library allows you to design asynchronous Actor and Dataflow based applications. While similar to Microsoft's Reactive Extensions, it goes far beyond what is offered by Rx with a more generalized abstraction to build all types of stream based applications. It does not force you to use IObservable and LINQ, data is simply a stream.

Messages transmit data from one block to another over links. Blocks handle the details of multithreading and execute anytime they receive data. All you have to think about is programming the blocks to do what you want. Focus on the problem domain not asynchronous details.

Downloadable code examples are used throughout the book to explain the library with a hands-on approach (

For a complete understanding of dataflow theory and application, please see my other book "Dataflow and Reactive Programming Systems". While chapter two of this book is included in my other book, it does not contain best practices and program design tips specific to TPL Dataflow.

About the Author

Matt Carkci
Matt Carkci

Matt Carkci has a Bachelor of Science degree in Electronic Engineering and over two decades of experience developing software in C/C++, C#, Java and Haskell. He has worked for government contractors, private corporations and has started a business or two but now spends his time researching and writing about interesting technologies. All proceeds go to feeding his ravenous 80 lb. puppy that never seems to get full.

Visit his site at

Bundles that include this book

Bought separately
Bundle Price

Table of Contents

  • Other Dataflow Books
  • Code Examples
  • 1 Getting Started
    • 1.1 What is TPL Dataflow
    • 1.2 What is Dataflow
    • 1.3 Where is Dataflow Used?
    • 1.4 TPL Dataflow vs. Rx
    • 1.5 Installing TPL Dataflow
  • 2 TPL Dataflow Basics
    • 2.1 Blocks
      • 2.1.1 Execution Blocks
        • ActionBlock<T>
        • TransformBlock<T1,T2>
        • Block Configuration
        • Execution Block Options
      • 2.1.2 Buffering Blocks
        • BufferBlock<T>
        • BroadcastBlock<T>
        • WriteOnceBlock<T>
        • DataflowBlockOptions
      • 2.1.3 Grouping Blocks
        • BatchBlock<T>
        • JoinBlock<T1,T2>
        • BatchedJoinBlock<T1,T2>
        • GroupingDataflowBlockOptions
      • 2.1.4 Block Completion
    • 2.2 Links
      • 2.2.1 DataflowLinkOptions
  • 3 Using TPL Dataflow
    • 3.1 A Generator Block
    • 3.2 How Messages are Transmitted
    • 3.3 Runtime Modification
    • 3.4 Maintaining State Inside an Execution Block
    • 3.5 Converting a Stateful Block to be Stateless
  • 4 Dataflow Program Design
    • 4.1 Block Design
      • 4.1.1 Design for Reuse
      • 4.1.2 Create Blocks from Scratch only when Necessary
      • 4.1.3 Develop Your Own Block Interface
      • 4.1.4 Careful with Retaining State in Blocks
    • 4.2 Favor Application Specific Blocks Over Predefined Blocks
    • 4.3 Avoid Excess Synchronization and Blocks
    • 4.4 Dealing with Loops and Cycles
    • 4.5 Prevent Large Buffers
    • 4.6 Data Should be Immutable
    • 4.7 Use SingleProducerConstrained if Possible

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub