MongolianBarbecue/Consumer.cs
/// <summary>
/// Loads the message with the given <paramref name="messageId"/>, returning null if it doesn't exist.
/// </summary>
Loads the message with the given , returning null if it doesn't exist.
Loads the message with the given returning null if it doesn ' t exist .
public async Task<ReceivedMessage> LoadAsync(string messageId)
        {
            if (messageId == null) throw new ArgumentNullException(nameof(messageId));
            var collection = _config.Collection;
            await _semaphore.WaitAsync();
            try
            {
                using (var cursor = await collection.FindAsync(d => d["_id"] == messageId))
                {
                    var document = await cursor.FirstOrDefaultAsync();
                    if (document == null) return null;
                    return GetReceivedMessage(document);
                }
            }
            finally
            {
                _semaphore.Release();
            }
        }
public async Task < ReceivedMessage > LoadAsync ( string messageId ) { if ( messageId == null ) throw new ArgumentNullException ( nameof ( messageId ) ) ; var collection = _config . Collection ; await _semaphore . WaitAsync ( ) ; try { using ( var cursor = await collection . FindAsync ( d => d [ " " ] == messageId ) ) { var document = await cursor . FirstOrDefaultAsync ( ) ; if ( document == null ) return null ; return GetReceivedMessage ( document ) ; } } finally { _semaphore . Release ( ) ; } }
Loads the message with the given , returning null if it doesn't exist.
Loads the message with the given returning null if it doesn ' t exist .
messageId
string