コード例 #1
0
            protected override async Task CopyMessageToPoisonQueueAsync(CloudQueueMessage message, CloudQueue poisonQueue, CancellationToken cancellationToken)
            {
                FakeStorageQueueMessage fakeMessage = new FakeStorageQueueMessage(message);

                await _poisonQueue.CreateIfNotExistsAsync(cancellationToken);

                await _poisonQueue.AddMessageAsync(fakeMessage, cancellationToken);

                OnMessageAddedToPoisonQueue(new PoisonMessageEventArgs(message, poisonQueue));
            }
コード例 #2
0
            public void AddMessage(MutableStorageQueueMessage message)
            {
                // need to create a new instance so other queues handling this message aren't updated
                DateTimeOffset now        = DateTimeOffset.Now;
                var            newMessage = new FakeStorageQueueMessage(CloudQueueMessage.CreateCloudQueueMessageFromByteArray(message.AsBytes))
                {
                    Id              = Guid.NewGuid().ToString(),
                    InsertionTime   = now,
                    ExpirationTime  = now.AddDays(7),
                    NextVisibleTime = now
                };

                _visibleMessages.Enqueue(newMessage);
            }
コード例 #3
0
        public Task AddMessageAsync(IStorageQueueMessage message, CancellationToken cancellationToken)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            MutableStorageQueueMessage storeMessage = message as MutableStorageQueueMessage;

            if (storeMessage == null)
            {
                storeMessage = new FakeStorageQueueMessage(message.SdkObject);
            }

            _store.AddMessage(_queueName, storeMessage);
            return Task.FromResult(0);
        }
コード例 #4
0
        public Task AddMessageAsync(IStorageQueueMessage message, CancellationToken cancellationToken)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            MutableStorageQueueMessage storeMessage = message as MutableStorageQueueMessage;

            if (storeMessage == null)
            {
                storeMessage = new FakeStorageQueueMessage(message.SdkObject);
            }

            _store.AddMessage(_queueName, storeMessage);
            return(Task.FromResult(0));
        }
コード例 #5
0
            protected override async Task CopyMessageToPoisonQueueAsync(CloudQueueMessage message, CancellationToken cancellationToken)
            {
                FakeStorageQueueMessage fakeMessage = new FakeStorageQueueMessage(message);

                await _poisonQueue.CreateIfNotExistsAsync(cancellationToken);
                await _poisonQueue.AddMessageAsync(fakeMessage, cancellationToken);

                OnMessageAddedToPoisonQueue(EventArgs.Empty);
            }
コード例 #6
0
 protected override async Task DeleteMessageAsync(CloudQueueMessage message, CancellationToken cancellationToken)
 {
     FakeStorageQueueMessage fakeMessage = new FakeStorageQueueMessage(message);
     await _queue.DeleteMessageAsync(fakeMessage, cancellationToken);
 }
コード例 #7
0
            protected override async Task ReleaseMessageAsync(CloudQueueMessage message, FunctionResult result, TimeSpan visibilityTimeout, CancellationToken cancellationToken)
            {
                FakeStorageQueueMessage fakeMessage = new FakeStorageQueueMessage(message);

                await _queue.UpdateMessageAsync(fakeMessage, visibilityTimeout, MessageUpdateFields.Visibility, cancellationToken);
            }
コード例 #8
0
 protected override async Task DeleteMessageAsync(CloudQueueMessage message, CancellationToken cancellationToken)
 {
     FakeStorageQueueMessage fakeMessage = new FakeStorageQueueMessage(message);
     await _queue.DeleteMessageAsync(fakeMessage, cancellationToken);
 }
コード例 #9
0
            protected override async Task ReleaseMessageAsync(CloudQueueMessage message, FunctionResult result, TimeSpan visibilityTimeout, CancellationToken cancellationToken)
            {
                FakeStorageQueueMessage fakeMessage = new FakeStorageQueueMessage(message);

                await _queue.UpdateMessageAsync(fakeMessage, visibilityTimeout, MessageUpdateFields.Visibility, cancellationToken);
            }