Пример #1
0
        public async Task Handle(ToDoItemCompletedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.CreateLogger <ToDoItemCreatedDomainEvent>().LogTrace("ToDoItemCompletedDomainEventHandler Start ......");
            var item = _todoRepository.GetAsync(@event.ItemId);

            var integrationEvent = new EmailNotificationIntegrationEvent(@event.ItemId);

            await _appIntegrationEventService.AddAndSaveEventAsync(integrationEvent);
        }
Пример #2
0
        private void CheckConfirmedGracePeriodItems()
        {
            _logger.LogDebug("Checking confirmed grace period todoItems");

            var todoIds = GetToDoItems();

            foreach (var orderId in todoIds)
            {
                var @event = new EmailNotificationIntegrationEvent(orderId);

                _logger.LogInformation("----- Publishing integration event: {IntegrationEventId} from {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);

                _eventBus.Publish(@event);
            }
        }
 private void Publish(EmailNotificationIntegrationEvent message)
 {
     _bus.PublishAsync(message)
     .ContinueWith(task =>
     {
         if (task.IsCompleted)
         {
             Console.WriteLine("Publish email generation event: {0} {1}", message.DisputeGuid, message.MessageType);
         }
         if (task.IsFaulted)
         {
             Console.Out.WriteLine("\n\n");
             Console.Out.WriteLine(task.Exception);
             Console.Out.WriteLine("\n\n");
         }
     });
 }