NServiceBus.ReceiveStrategy.TryProcessMessage C# (CSharp) Method

TryProcessMessage() protected method

protected TryProcessMessage ( string messageId, string>.Dictionary headers, Stream bodyStream, TransportTransaction transaction ) : Task
messageId string
headers string>.Dictionary
bodyStream Stream
transaction TransportTransaction
return Task
        protected async Task<bool> TryProcessMessage(string messageId, Dictionary<string, string> headers, Stream bodyStream, TransportTransaction transaction)
        {
            using (var tokenSource = new CancellationTokenSource())
            {
                var body = await ReadStream(bodyStream).ConfigureAwait(false);
                var messageContext = new MessageContext(messageId, headers, body, transaction, tokenSource, new ContextBag());

                await onMessage(messageContext).ConfigureAwait(false);

                return tokenSource.Token.IsCancellationRequested;
            }
        }