示例#1
0
        public void ProcessQueueMessage([QueueTrigger("commandqueue")] string message, ILogger logger)
        {
            logger.LogInformation(message);

            var command = JsonConvert.DeserializeObject <ICommand>(
                message,
                new JsonSerializerSettings
            {
                TypeNameHandling = TypeNameHandling.All
            });

            _commandDispatcher.Publish(command);
        }
        private void DeQueueMessage()
        {
            var result = _commandQueueService.TryDeleteMessageAsync().Result;

            if (!result.IsSuccess || string.IsNullOrWhiteSpace(result.Content))
            {
                return;
            }

            _logger.LogInformation($"de-queued message {result.Content}");

            var command = JsonConvert.DeserializeObject <ICommand>(
                result.Content,
                new JsonSerializerSettings
            {
                TypeNameHandling = TypeNameHandling.All
            });

            _commandDispatcher.Publish(command);
        }