public void Handle(NewsCreated e) { NewsArticles.Add(new News { Id = e.NewsId, TournamentId = e.Id, Title = e.Title, Content = e.Content, Created = e.Created }); }
private async Task SendMessageToBus(NewsCreated command) { Uri UriBuilder(string server, string vHost) { return(new Uri($"{server}/{vHost}")); } var uri = UriBuilder(_configuration.GetSection("RabbitMqSettings:Host").Value, "ENews.Events.V1.NewsCreated"); var sendEndpoint = await _bus.GetSendEndpoint(uri); await sendEndpoint.Send(command); }
public async Task Handle(CreateNewsDomainEvent notification, CancellationToken cancellationToken) { try { var message = new NewsCreated(notification.News.AgencyCode, notification.News.NewsContent, notification.News.CreatedOn, notification.News.IsActive); await SendMessageToBus(message); } catch (Exception e) { Log.Error(e.Message); Log.ForContext <CreateNewsCommandHandler>() .Error( "Haber Kuyruğa atılamadı : {@notification}", JsonSerializer.Serialize(notification)); } }
public async Task SendNewsToAgency(NewsCreated message) { var info = await _integrationDefinationService.GetIntegrationDetails(message.AgencyCode); if (info == null) { throw new Exception($"Setting Bulunamadı: {JsonSerializer.Serialize(message)}"); } if (info.IsActive) { var msgContent = new StringContent(JsonSerializer.Serialize(message), Encoding.UTF8, "application/json"); await SendRequestToIntegration(msgContent, info); } }
void Apply(NewsCreated e) { Id = e.Id.ToString(); _title = e.Title; _allowComment = e.AllowComment; }
public void Apply(NewsCreated e) { //TODO: nothing at this time }