public void Handle(IDomainEventEnvelope <TestMessageType4> @event)
 {
     _logger.LogDebug("Got message MessageType4Event with id={} and value={}", @event.EventId,
                      @event.Event.ToString());
     TestEventConsumer.EventStatistics eventStatistics = TestEventConsumer.GetEventStatistics(typeof(TestMessageType4));
     TestEventConsumer.HandleTestMessageEvent(@event, eventStatistics);
 }
        private void HandleMessageType2Event(IDomainEventEnvelope <TestMessageType2> @event)
        {
            _logger.LogDebug("Got message MessageType2Event with id={} and value={}", @event.EventId,
                             @event.Event.ToString());
            EventStatistics eventStatistics = GetEventStatistics(typeof(TestMessageType2));

            HandleTestMessageEvent(@event, eventStatistics);
        }
示例#3
0
        public void AssertGoodMessageReceived(IDomainEventEnvelope <IDomainEvent> receivedMessage)
        {
            Assert.True(receivedMessage.Message.HasHeader(MessageHeaders.Id), "Message ID is in the header");
            TestMessageType2 @event = (TestMessageType2)receivedMessage.Event;

            Assert.AreEqual(Name, @event.Name, "Message Name is the same");
            Assert.AreEqual(Value, @event.Value, "Message Value is the same");
        }
        private void HandleMessageType1Event(IDomainEventEnvelope <TestMessageType1> @event)
        {
            _logger.LogDebug("Got MessageType1Event with id={} and value={}", @event.EventId,
                             @event.Event.ToString());
            EventStatistics eventStatistics = GetEventStatistics(typeof(TestMessageType1));

            HandleTestMessageEvent(@event, eventStatistics);
            if (@event.Event.Name.Equals("ThrowException") && ExceptionCount < 5)
            {
                ExceptionCount++;
                throw (new Exception());
            }
        }
        public void HandleTestMessageEvent(IDomainEventEnvelope <IDomainEvent> @event, EventStatistics eventStatistics)
        {
            DateTime receivedTime = DateTime.Now;

            if (receivedTime < eventStatistics.FirstMessageTime)
            {
                eventStatistics.FirstMessageTime = receivedTime;
            }
            if (receivedTime > eventStatistics.LastMessageTime)
            {
                eventStatistics.LastMessageTime = receivedTime;
            }
            eventStatistics.MessageCount++;
            eventStatistics.ReceivedMessages.Add(@event);
        }
 public void Handle(IDomainEventEnvelope <OrderCreatedEvent> orderCreatedEvent)
 {
     customerService.ReserveCredit(Convert.ToInt32(orderCreatedEvent.AggregateId), orderCreatedEvent.Event.OrderDetails.CustomerId, orderCreatedEvent.Event.OrderDetails.OrderTotal);
 }
 public void Handle(IDomainEventEnvelope <OrderRejectedEvent> orderRejectedEvent)
 {
     events.Add(orderRejectedEvent.Event);
 }
 public void Handle(IDomainEventEnvelope <OrderApprovedEvent> OrderApprovedEvent)
 {
     events.Add(OrderApprovedEvent.Event);
 }
 public void Handle(IDomainEventEnvelope <OrderCancelledEvent> orderCancelledEvent)
 {
     events.Add(orderCancelledEvent.Event);
 }
 public void Handle(IDomainEventEnvelope <CustomerCreditReservationFailedEvent> customerCreditReservationFailedEvent)
 {
     events.Add(customerCreditReservationFailedEvent.Event);
 }
 public void Handle(IDomainEventEnvelope <CustomerValidationFailedEvent> customerValidationFailedEvent)
 {
     events.Add(customerValidationFailedEvent.Event);
 }
 public void Handle(IDomainEventEnvelope <CustomerCreditReservationFailedEvent> customerCreditReservationFailedEvent)
 {
     orderService.RejectOrder(customerCreditReservationFailedEvent.Event.orderId);
 }
 public void Handle(IDomainEventEnvelope <CustomerCreditReservedEvent> customerCreditReservedEvent)
 {
     orderService.ApproveOrder(customerCreditReservedEvent.Event.orderId);
 }
示例#14
0
 public void Handle(IDomainEventEnvelope <OrderCancelledEvent> orderCancelledEvent)
 {
     orderHistoryViewService.CancelOrder(orderCancelledEvent.Event.OrderDetails.CustomerId, Convert.ToInt64(orderCancelledEvent.AggregateId));
 }
示例#15
0
 public void Handle(IDomainEventEnvelope <OrderCreatedEvent> orderCreatedEvent)
 {
     orderHistoryViewService.AddOrder(orderCreatedEvent.Event.OrderDetails.CustomerId, Convert.ToInt64(orderCreatedEvent.AggregateId), orderCreatedEvent.Event.OrderDetails.OrderTotal);
 }
示例#16
0
 public void Handle(IDomainEventEnvelope <CustomerCreatedEvent> customerCreatedEvent)
 {
     orderHistoryViewService.CreateCustomer(Convert.ToInt64(customerCreatedEvent.AggregateId), customerCreatedEvent.Event.Name, customerCreatedEvent.Event.CreditLimit);
 }
 public void Handle(IDomainEventEnvelope <OrderCancelledEvent> orderCancelledEvent)
 {
     customerService.ReleaseCredit(Convert.ToInt32(orderCancelledEvent.AggregateId), orderCancelledEvent.Event.OrderDetails.CustomerId);
 }
        public void Handle(IDomainEventEnvelope <BlogCreatedEvent> @event)
        {
            var payload = @event.Message.Payload.FromJson <BlogCreatedEvent>();

            _logger.LogInformation($"Got message BlogCreatedEvent for blog with ID: {payload.BlogId}");
        }
 internal void HandleAccountDebited(IDomainEventEnvelope <MyDomainEvent> message)
 {
     Queue.Enqueue(message);
 }
 public void Handle(IDomainEventEnvelope <CustomerCreatedEvent> customerCreatedEvent)
 {
     events.Add(customerCreatedEvent.Event);
 }
示例#21
0
 public void Invoke(IDomainEventEnvelope <IDomainEvent> domainEventEnvelope, IServiceProvider serviceProvider)
 {
     _handler(domainEventEnvelope, serviceProvider);
 }