Interface IOutboundMessageFilter
- Namespace
- Silverback.Messaging.Producing.Filter
- Assembly
- Silverback.Integration.dll
Can be used to filter out messages that should not be produced.
public interface IOutboundMessageFilter
Methods
ShouldProduceAsync(IOutboundEnvelope, CancellationToken)
Returns a value indicating whether the specified message should be produced.
ValueTask<bool> ShouldProduceAsync(IOutboundEnvelope envelope, CancellationToken cancellationToken)
Parameters
envelopeIOutboundEnvelopeThe envelope containing the message to be filtered.
cancellationTokenCancellationTokenA CancellationToken used to cancel the operation.
Returns
- ValueTask<bool>
A ValueTask<TResult> representing the asynchronous operation. The task result contains a value indicating whether the message should be produced.
Remarks
The filter might also be invoked while the caller synchronously waits for the message to be produced, for example when using
the synchronous IProducer or IPublisher methods or when publishing a batch. Use
ConfigureAwait(false) when awaiting and keep the asynchronous work short, to avoid deadlocks and blocked threads.