source/TestCommon/source/FunctionApp.TestCommon/ServiceBus/ListenerMock/ServiceBusListenerMock.cs
/// <summary>
/// Add a listener for given queue name.
/// The listener starts reading messages instantly when added.
/// </summary>
/// <param name="queueName">Name of the queue to read messages of.</param>
Add a listener for given queue name.
The listener starts reading messages instantly when added.
Add a listener for given queue name . The listener starts reading messages instantly when added .
public async Task AddQueueListenerAsync(string queueName)
        {
            if (string.IsNullOrWhiteSpace(queueName))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(queueName));
            }
            if (!await AdministrationClient.QueueExistsAsync(queueName).ConfigureAwait(false))
            {
                throw new InvalidOperationException($"Queue '{queueName}' does not exists.");
            }
            var options = CreateDefaultProcessorOptions();
            var receiver = Client.CreateProcessor(queueName, options);
            await AddMessageReceiverAsync(queueName, receiver).ConfigureAwait(false);
        }
public async Task AddQueueListenerAsync ( string queueName ) { if ( string . IsNullOrWhiteSpace ( queueName ) ) { throw new ArgumentException ( " " , nameof ( queueName ) ) ; } if ( ! await AdministrationClient . QueueExistsAsync ( queueName ) . ConfigureAwait ( false ) ) { throw new InvalidOperationException ( $" Queue ' { queueName } ' does not exists. " ) ; } var options = CreateDefaultProcessorOptions ( ) ; var receiver = Client . CreateProcessor ( queueName , options ) ; await AddMessageReceiverAsync ( queueName , receiver ) . ConfigureAwait ( false ) ; }
Add a listener for given queue name.
Add a listener for given queue name .
queueName
string
Name of the queue to read messages of.
Name of the queue to read messages of .