Share via

ActionBlock<TInput>.ITargetBlock<TInput>.OfferMessage Method


Offers a message to the dataflow block, and gives it the opportunity to consume or postpone the message.

 virtual System::Threading::Tasks::Dataflow::DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock<TInput>.OfferMessage(System::Threading::Tasks::Dataflow::DataflowMessageHeader messageHeader, TInput messageValue, System::Threading::Tasks::Dataflow::ISourceBlock<TInput> ^ source, bool consumeToAccept) = System::Threading::Tasks::Dataflow::ITargetBlock<TInput>::OfferMessage;
System.Threading.Tasks.Dataflow.DataflowMessageStatus ITargetBlock<TInput>.OfferMessage (System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock<TInput> source, bool consumeToAccept);
abstract member System.Threading.Tasks.Dataflow.ITargetBlock<TInput>.OfferMessage : System.Threading.Tasks.Dataflow.DataflowMessageHeader * 'Input * System.Threading.Tasks.Dataflow.ISourceBlock<'Input> * bool -> System.Threading.Tasks.Dataflow.DataflowMessageStatus
override this.System.Threading.Tasks.Dataflow.ITargetBlock<TInput>.OfferMessage : System.Threading.Tasks.Dataflow.DataflowMessageHeader * 'Input * System.Threading.Tasks.Dataflow.ISourceBlock<'Input> * bool -> System.Threading.Tasks.Dataflow.DataflowMessageStatus
Function OfferMessage (messageHeader As DataflowMessageHeader, messageValue As TInput, source As ISourceBlock(Of TInput), consumeToAccept As Boolean) As DataflowMessageStatus Implements ITargetBlock(Of TInput).OfferMessage



The header of the message being offered.


The value of the message being offered.


The dataflow block that is offering the message. This may be null.


true to instruct the target to call ConsumeMessage(DataflowMessageHeader, ITargetBlock<TOutput>, Boolean) synchronously during the call to OfferMessage(DataflowMessageHeader, TInput, ISourceBlock<TInput>, Boolean), prior to returning Accepted, in order to consume the message; otherwise, false.


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, because 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 message, but source was null, Declined is 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.



messageHeader is not valid.

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

Applies to