public async Task AddOrUpdateElasticNews(NewsUpdateOrCreateCommand newsUpdateOrCreate) { _routing.RouteToEndpoint(typeof(NewsUpdateOrCreateCommand), _messageQueueName); var endpointInstance = await Endpoint.Start(_endPoint).ConfigureAwait(false); await endpointInstance.Send(newsUpdateOrCreate).ConfigureAwait(false); await endpointInstance.Stop().ConfigureAwait(false); }
private async Task ToQueueElasticUpdate(News newNews) { NewsUpdateOrCreateCommand newsUpdateOrCreate = new NewsUpdateOrCreateCommand { ApplicationUserId = newNews.ApplicationUserId, Body = newNews.Body, CategoryId = newNews.CategoryId, CategoryName = (await _database.CategoryRepository.GetById(newNews.CategoryId)).Name, CreatedDate = newNews.CreatedDate, Description = newNews.Description, Id = newNews.Id, Published = newNews.Published, Title = newNews.Title, UserName = (await _database.ProfileRepository.GetById(newNews.ApplicationUserId)).Name }; await _senderToElastic.AddOrUpdateElasticNews(newsUpdateOrCreate); }