ITargetBlock<TInput>.OfferMessage Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Offers a message to the ITargetBlock<TInput>, giving the target the opportunity to consume or postpone the message.
public System.Threading.Tasks.Dataflow.DataflowMessageStatus OfferMessage (System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock<in TInput> source, bool consumeToAccept);
public System.Threading.Tasks.Dataflow.DataflowMessageStatus OfferMessage (System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock<in TInput>? source, bool consumeToAccept);
abstract member OfferMessage : System.Threading.Tasks.Dataflow.DataflowMessageHeader * 'Input * System.Threading.Tasks.Dataflow.ISourceBlock<'Input> * bool -> System.Threading.Tasks.Dataflow.DataflowMessageStatus
Public Function OfferMessage (messageHeader As DataflowMessageHeader, messageValue As TInput, source As ISourceBlock(Of In TInput), consumeToAccept As Boolean) As DataflowMessageStatus
Parameters
- messageHeader
- DataflowMessageHeader
A DataflowMessageHeader instance that represents the header of the message being offered.
- messageValue
- TInput
The value of the message being offered.
- source
- ISourceBlock<TInput>
The ISourceBlock<TOutput> offering the message. This may be null.
- consumeToAccept
- Boolean
Set to 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.
Returns
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 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.
Exceptions
The messageHeader
is not valid.
-or- consumeToAccept
may only be true if provided with a non-null source
.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기