コード例 #1
0
        public async Task EnqueueAsync(BlobTriggerMessage message, CancellationToken cancellationToken)
        {
            string contents = JsonConvert.SerializeObject(message, JsonSerialization.Settings);
            await _queue.AddMessageAndCreateIfNotExistsAsync(_queue.CreateMessage(contents), cancellationToken);

            _watcher.Notify(_queue.Name);
        }
コード例 #2
0
            internal async Task EnqueueAsync(JObject data, String functionId, CancellationToken cancellationToken)
            {
                string contents = JsonConvert.SerializeObject(new QueueMessage(data, functionId), JsonSerialization.Settings);
                await _queue.AddMessageAndCreateIfNotExistsAsync(_queue.CreateMessage(contents), cancellationToken);

                _watcher.Notify(_queue.Name);
            }
コード例 #3
0
        private async Task CopyToPoisonQueueAsync(IStorageQueueMessage message, CancellationToken cancellationToken)
        {
            await _poisonQueue.AddMessageAndCreateIfNotExistsAsync(message, cancellationToken);

            if (_sharedWatcher != null)
            {
                _sharedWatcher.Notify(_poisonQueue.Name);
            }
        }
コード例 #4
0
        public Task AddAsync(T item, CancellationToken cancellationToken)
        {
            IStorageQueueMessage message = _converter.Convert(item);

            if (message == null)
            {
                throw new InvalidOperationException("Cannot enqueue a null queue message instance.");
            }

            return(_queue.AddMessageAndCreateIfNotExistsAsync(message, cancellationToken));
        }
コード例 #5
0
        public void Add(T item)
        {
            IStorageQueueMessage message = _converter.Convert(item);

            if (message == null)
            {
                throw new InvalidOperationException("Cannot enqueue a null queue message instance.");
            }

            _queue.AddMessageAndCreateIfNotExistsAsync(message, CancellationToken.None).GetAwaiter().GetResult();
        }
コード例 #6
0
        public async Task SetValueAsync(object value, CancellationToken cancellationToken)
        {
            IStorageQueueMessage message = _converter.Convert((TInput)value);

            Debug.Assert(message != null);
            await _queue.AddMessageAndCreateIfNotExistsAsync(message, cancellationToken);

            if (_messageEnqueuedWatcher != null)
            {
                _messageEnqueuedWatcher.Notify(_queue.Name);
            }
        }
コード例 #7
0
            public async Task AddAsync(IStorageQueueMessage message, CancellationToken cancellationToken = default(CancellationToken))
            {
                if (message == null)
                {
                    throw new InvalidOperationException("Cannot enqueue a null queue message instance.");
                }

                await _queue.AddMessageAndCreateIfNotExistsAsync(message, cancellationToken);

                if (_messageEnqueuedWatcher != null)
                {
                    _messageEnqueuedWatcher.Notify(_queue.Name);
                }
            }