Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

TransformManyBlock<TInput, TOutput>.ITargetBlock<TInput>.OfferMessage Method

.NET Framework 4.6 and 4.5

Offers a message to the ITargetBlock<TInput>, giving the target the opportunity to consume or postpone the message.

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

DataflowMessageStatus ITargetBlock<TInput>.OfferMessage(
	DataflowMessageHeader messageHeader,
	TInput messageValue,
	ISourceBlock<TInput> source,
	bool consumeToAccept
)

Parameters

messageHeader
Type: System.Threading.Tasks.Dataflow.DataflowMessageHeader

A DataflowMessageHeader instance that represents the header of the message being offered.

messageValue
Type: TInput

The value of the message being offered.

source
Type: System.Threading.Tasks.Dataflow.ISourceBlock<TInput>

The ISourceBlock<TOutput> offering the message. This may be null.

consumeToAccept
Type: System.Boolean

true if the target must call ConsumeMessage synchronously during the call to ITargetBlock<TInput>, prior to returning Accepted, in order to consume the message.

Return Value

Type: System.Threading.Tasks.Dataflow.DataflowMessageStatus
The status of the offered message. If the message was accepted by the target, Accepted is returned, and the source should no longer use the offered message, as it is now owned by the target. If the message was postponed by the target, Postponed is returned as a notification that the target may later attempt to consume or reserve the message; in the meantime, the source still owns the message and may offer it to other blocks.
If the target would have otherwise postponed but source was null, Declined is instead returned.
If the target tried to accept the message but missed it due to the source delivering the message to another target or simply discarding it, NotAvailable is returned.
If the target chose not to accept the message, Declined is returned. If the target chose not to accept the message and will never accept another message from this source, DecliningPermanently is returned.

Implements

ITargetBlock<TInput>.OfferMessage(DataflowMessageHeader, TInput, ISourceBlock<TInput>, Boolean)

ExceptionCondition
ArgumentException

The messageHeader is not valid.

-or-

consumeToAccept may only be true if provided with a non-null source.

.NET Framework

Supported in: 4.5

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft