source/TestCommon/source/FunctionApp.TestCommon/ServiceBus/ListenerMock/ServiceBusListenerMock.cs
/// <summary>
/// All messages received by all message receivers arrives here.
/// </summary>
All messages received by all message receivers arrives here.
All messages received by all message receivers arrives here .
private async Task HandleMessageReceivedAsync(ProcessMessageEventArgs arg)
        {
            Func<ServiceBusReceivedMessage, Task> messageHandler;
            await MutableReceivedMessagesLock.WaitAsync(arg.CancellationToken).ConfigureAwait(false);
            try
            {
                MutableReceivedMessages.Add(arg.Message, arg.CancellationToken);
                messageHandler = GetMessageHandler(arg.Message);
            }
            finally
            {
                MutableReceivedMessagesLock.Release();
            }
            try
            {
                await messageHandler(arg.Message).ConfigureAwait(false);
            }
            catch
            {
            }
        }
private async Task HandleMessageReceivedAsync ( ProcessMessageEventArgs arg ) { Func < ServiceBusReceivedMessage , Task > messageHandler ; await MutableReceivedMessagesLock . WaitAsync ( arg . CancellationToken ) . ConfigureAwait ( false ) ; try { MutableReceivedMessages . Add ( arg . Message , arg . CancellationToken ) ; messageHandler = GetMessageHandler ( arg . Message ) ; } finally { MutableReceivedMessagesLock . Release ( ) ; } try { await messageHandler ( arg . Message ) . ConfigureAwait ( false ) ; } catch { } }
All messages received by all message receivers arrives here.
All messages received by all message receivers arrives here .
// Ignore the exception so the message is taking off service bus.
arg
ProcessMessageEventArgs