Search code examples
c#task-parallel-librarydataflowtpl-dataflow

TPL Dataflow, notification when data block received first item


I wonder whether it is possible to subscribe to a one-time notification when the first item is received in the input buffer or processed in a data block. I am aware I can set a flag within the data block but that would create overhead as it would run check the flag on each new item. My data block processes several million items thus this flag adds unnecessary overhead.

Is there a better way to be notified on the first incoming item?


Solution

  • You could try creating a link with MaxMessages=1 to a block that processes the notification. This link would be removed after delivering a single message.