示例#1
0
        public async Task UpdateElasticCategories(UpdateCategoriesInfoCommand categories)
        {
            _routing.RouteToEndpoint(typeof(UpdateCategoriesInfoCommand), _messageQueueName);
            var endpointInstance = await Endpoint.Start(_endPoint).ConfigureAwait(false);

            await endpointInstance.Send(categories).ConfigureAwait(false);

            await endpointInstance.Stop().ConfigureAwait(false);
        }
示例#2
0
        private async Task ToQueueElasticUpdate(Category category)
        {
            UpdateCategoriesInfoCommand categoryUpdateOrCreate = new UpdateCategoriesInfoCommand
            {
                Id        = category.Id,
                Name      = category.Name,
                CountNews = NewsCountByCategory(category.Id)
            };

            await _senderToElastic.UpdateElasticCategories(categoryUpdateOrCreate);
        }
示例#3
0
        private async Task ToQueueElasticUpdate(int id)
        {
            Category temp = await _database.CategoryRepository.GetById(id);

            UpdateCategoriesInfoCommand categoryUpdateOrCreate = new UpdateCategoriesInfoCommand
            {
                Id        = id,
                Name      = temp.Name,
                CountNews = temp.News.Count
            };

            await _senderToElastic.UpdateElasticCategories(categoryUpdateOrCreate);
        }