MSDN Library

ISourceBlock(Of TOutput).ConsumeMessage Method

.NET Framework (current version)

Called by a linked ITargetBlock(Of TInput) to accept and consume a DataflowMessageHeader previously offered by this ISourceBlock(Of TOutput).

Namespace:  System.Threading.Tasks.Dataflow
Assembly:  System.Threading.Tasks.Dataflow (in System.Threading.Tasks.Dataflow.dll)

Function ConsumeMessage ( _
	messageHeader As DataflowMessageHeader, _
	target As ITargetBlock(Of TOutput), _
	<OutAttribute> ByRef messageConsumed As Boolean _
) As TOutput


Type: System.Threading.Tasks.Dataflow.DataflowMessageHeader

The DataflowMessageHeader of the message being consumed.

Type: System.Threading.Tasks.Dataflow.ITargetBlock(Of TOutput)

The ITargetBlock(Of TInput) consuming the message.

Type: System.Boolean

true if the message was successfully consumed; otherwise, false.

Return Value

Type: TOutput
The value of the consumed message. This may correspond to a different DataflowMessageHeader instance than was previously reserved and passed as the messageHeader to ConsumeMessage. The consuming ITargetBlock(Of TInput) must use the returned value instead of the value passed as messageValue through OfferMessage.
If the message requested is not available, the return value will be Nothing.


The messageHeader is not valid.


The target is Nothing.

Only ITargetBlock(Of TInput) instances linked to this ISourceBlock(Of TOutput) instance may use ConsumeMessage, and it must only be used to consume DataflowMessageHeader instances previously offered by this source to the target.

.NET Framework

Supported in: 4.5

Portable Class Library

Supported in: Portable Class Library
© 2016 Microsoft