コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 public ApplicationMessageProcessedEventArgs(ManagedMqttApplicationMessage applicationMessage, Exception exception)
 {
     ApplicationMessage = applicationMessage ?? throw new ArgumentNullException(nameof(applicationMessage));
     Exception          = exception;
 }
コード例 #4
0
 public ApplicationMessageSkippedEventArgs(ManagedMqttApplicationMessage applicationMessage)
 {
     ApplicationMessage = applicationMessage ?? throw new ArgumentNullException(nameof(applicationMessage));
 }