Beispiel #1
0
 internal void Apply(CustomerUpdatedEvent ev)
 {
     Email      = ev.NewEmail;
     Address    = ev.NewAddress;
     PostalCode = ev.NewPostalCode;
     Residence  = ev.NewResidence;
 }
        public async Task Handle(UpdateCustomerCommand command, CancellationToken cancellationToken)
        {
            var updatedEvent = new CustomerUpdatedEvent
            {
                CustomerId = command.CustomerId,
                Address    = command.Address,
                Name       = command.Name,
                Phone      = command.Phone,
                CreatedAt  = DateTime.Now
            };

            // Insert event to Command Db
            await _eventSources.InserEvent(updatedEvent, cancellationToken);

            await _kafkaProducer.Send(updatedEvent, "PosServices");
        }
Beispiel #3
0
        public async Task ExecuteAsync(HookType type, IDomainEntityContext <Customer> context, CancellationToken cancellationToken)
        {
            switch (context.EditMode)
            {
            case EditMode.Create:
                await context.AddEventAsync(CustomerCreatedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken);

                break;

            case EditMode.Update:
                await context.AddEventAsync(CustomerUpdatedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken);

                break;

            case EditMode.Delete:
                await context.AddEventAsync(CustomerDeletedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken);

                break;
            }
        }
 public void Handle(CustomerUpdatedEvent message)
 {
     // Send some notification e-mail
 }
        public Task Handle(CustomerUpdatedEvent message, CancellationToken cancellationToken)
        {
            // Send some notification e-mail

            return(Task.CompletedTask);
        }
 public async Task Handle(CustomerUpdatedEvent message, CancellationToken cancellationToken)
 {
     await _customersBucket.DefaultCollection.UpsertAsync(message.Id.ToString(), message);
 }
 public async Task Handle(CustomerUpdatedEvent @event, CancellationToken cancellationToken)
 {
     await Save(@event);
 }
        /// <summary>
        /// 更新customer后激活的事件
        /// </summary>
        /// <param name="message"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public Task Handle(CustomerUpdatedEvent message, CancellationToken cancellationToken)
        {
            //可以刷新缓存或者其他操作

            return(Task.CompletedTask);
        }
        public Task Handle(CustomerUpdatedEvent notification, CancellationToken cancellationToken)
        {
            return(Task.CompletedTask);

            ;
        }
 public Task Handle(CustomerUpdatedEvent message, CancellationToken cancellationToken)
 {
     // Send some notification e-mail
     Console.WriteLine(message.Id);
     return(Task.CompletedTask);
 }