public async Task AddAsync(ManagedMqttApplicationMessage applicationMessage) { if (applicationMessage == null) { throw new ArgumentNullException(nameof(applicationMessage)); } using (await _messagesLock.WaitAsync(CancellationToken.None).ConfigureAwait(false)) { _messages.Add(applicationMessage); await SaveAsync().ConfigureAwait(false); } }
public async Task RemoveAsync(ManagedMqttApplicationMessage applicationMessage) { if (applicationMessage == null) { throw new ArgumentNullException(nameof(applicationMessage)); } using (await _messagesLock.WaitAsync(CancellationToken.None).ConfigureAwait(false)) { var index = _messages.IndexOf(applicationMessage); if (index == -1) { return; } _messages.RemoveAt(index); await SaveAsync().ConfigureAwait(false); } }
public ApplicationMessageProcessedEventArgs(ManagedMqttApplicationMessage applicationMessage, Exception exception) { ApplicationMessage = applicationMessage ?? throw new ArgumentNullException(nameof(applicationMessage)); Exception = exception; }
public ApplicationMessageSkippedEventArgs(ManagedMqttApplicationMessage applicationMessage) { ApplicationMessage = applicationMessage ?? throw new ArgumentNullException(nameof(applicationMessage)); }