MongolianBarbecue/Consumer.cs
/// <summary>
/// Abandons the lease for the message with the given <paramref name="messageId"/>.
/// This will set the <see cref="Fields.ReceiveTime"/> field of the message document to <see cref="DateTime.MinValue"/>.
/// </summary>
Abandons the lease for the message with the given .
This will set the  field of the message document to .
Abandons the lease for the message with the given . This will set the field of the message document to .
public async Task Nack(string messageId)
        {
            var collection = _config.Collection;
            var abandonUpdate = new BsonDocument
            {
                {"$set", new BsonDocument {{Fields.ReceiveTime, DateTime.MinValue}}}
            };
            await _semaphore.WaitAsync();
            try
            {
                await collection.UpdateOneAsync(doc => doc["_id"] == messageId, new BsonDocumentUpdateDefinition<BsonDocument>(abandonUpdate));
            }
            catch
            {
            }
            finally
            {
                _semaphore.Release();
            }
        }
public async Task Nack ( string messageId ) { var collection = _config . Collection ; var abandonUpdate = new BsonDocument { { " " , new BsonDocument { { Fields . ReceiveTime , DateTime . MinValue } } } } ; await _semaphore . WaitAsync ( ) ; try { await collection . UpdateOneAsync ( doc => doc [ " " ] == messageId , new BsonDocumentUpdateDefinition < BsonDocument > ( abandonUpdate ) ) ; } catch { } finally { _semaphore . Release ( ) ; } }
Abandons the lease for the message with the given .
Abandons the lease for the message with the given .
// lease will be released eventually
messageId
string