BroadcastBlock<T>.ITargetBlock<T>.OfferMessage(DataflowMessageHeader, T, ISourceBlock<T>, Boolean) Método
Definição
Oferece uma mensagem para o ITargetBlock<TInput>, que fornece ao destino a oportunidade de consumir ou adiar a mensagem.Offers a message to the ITargetBlock<TInput>, giving the target the opportunity to consume or postpone the message.
virtual System::Threading::Tasks::Dataflow::DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock<T>.OfferMessage(System::Threading::Tasks::Dataflow::DataflowMessageHeader messageHeader, T messageValue, System::Threading::Tasks::Dataflow::ISourceBlock<T> ^ source, bool consumeToAccept) = System::Threading::Tasks::Dataflow::ITargetBlock<T>::OfferMessage;
System.Threading.Tasks.Dataflow.DataflowMessageStatus ITargetBlock<T>.OfferMessage (System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock<T> source, bool consumeToAccept);
abstract member System.Threading.Tasks.Dataflow.ITargetBlock<T>.OfferMessage : System.Threading.Tasks.Dataflow.DataflowMessageHeader * 'T * System.Threading.Tasks.Dataflow.ISourceBlock<'T> * bool -> System.Threading.Tasks.Dataflow.DataflowMessageStatus
override this.System.Threading.Tasks.Dataflow.ITargetBlock<T>.OfferMessage : System.Threading.Tasks.Dataflow.DataflowMessageHeader * 'T * System.Threading.Tasks.Dataflow.ISourceBlock<'T> * bool -> System.Threading.Tasks.Dataflow.DataflowMessageStatus
Function OfferMessage (messageHeader As DataflowMessageHeader, messageValue As T, source As ISourceBlock(Of T), consumeToAccept As Boolean) As DataflowMessageStatus Implements ITargetBlock(Of T).OfferMessage
Parâmetros
- messageHeader
- DataflowMessageHeader
Uma instância DataflowMessageHeader que representa o cabeçalho da mensagem que está sendo oferecida.A DataflowMessageHeader instance that represents the header of the message being offered.
- messageValue
- T
O valor da mensagem que está sendo oferecida.The value of the message being offered.
- source
- ISourceBlock<T>
O ISourceBlock<TOutput> que oferece a mensagem.The ISourceBlock<TOutput> offering the message. Isso pode ser nulo.This may be null.
- consumeToAccept
- Boolean
Definido como true para instruir o destino a chamar ConsumeMessage(DataflowMessageHeader, ITargetBlock<TOutput>, Boolean) de forma síncrona durante a chamada para OfferMessage(DataflowMessageHeader, TInput, ISourceBlock<TInput>, Boolean), antes de retornar Accepted, para consumir a mensagem.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.
Retornos
O status da mensagem oferecida.The status of the offered message. Se a mensagem foi aceita pelo destino, Accepted é retornado e a fonte não deve mais usar a mensagem oferecida, porque agora ela é definida pelo destino.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. Se a mensagem foi adiada pelo destino, Postponed é retornado como uma notificação de que o destino pode tentar consumir ou reservar a mensagem mais tarde; enquanto isso, a fonte ainda tem a mensagem e pode oferecê-la aos outros blocos.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.
Se o destino teria adiado a mensagem, mas source era null, Declined é retornado em vez disso.If the target would have otherwise postponed message, but source was null, Declined is instead returned.
Se o destino tentou aceitar a mensagem, mas a perdeu devido à origem entregá-la para outro destino ou simplesmente descartando-a, NotAvailable será retornado.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.
Se o destino optou por não aceitar a mensagem, Declined é retornado.If the target chose not to accept the message, Declined is returned. Se o destino optou por não aceitar a mensagem e nunca aceitar outra mensagem desta fonte, DecliningPermanently é retornado.If the target chose not to accept the message and will never accept another message from this source, DecliningPermanently is returned.
Implementações
Exceções
O messageHeader não é válido.The messageHeader is not valid.
-ou- consumeToAccept poderá ser verdadeiro somente se receber um source não nulo.-or- consumeToAccept may only be true if provided with a non-null source.