Beispiel #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));
            }
Beispiel #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);
            }
        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);
        }
Beispiel #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));
        }
            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);
            }
 protected override async Task DeleteMessageAsync(CloudQueueMessage message, CancellationToken cancellationToken)
 {
     FakeStorageQueueMessage fakeMessage = new FakeStorageQueueMessage(message);
     await _queue.DeleteMessageAsync(fakeMessage, cancellationToken);
 }
            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);
            }
Beispiel #8
0
 protected override async Task DeleteMessageAsync(CloudQueueMessage message, CancellationToken cancellationToken)
 {
     FakeStorageQueueMessage fakeMessage = new FakeStorageQueueMessage(message);
     await _queue.DeleteMessageAsync(fakeMessage, cancellationToken);
 }
Beispiel #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);
            }