public DomainNotificationProcessor( IDomainNotifyingContext context, ILogger <DomainNotificationProcessor <TDomainNotification> > logger) { _logger = logger; _context = context; }
/// <summary> /// 2.1 从银行账户聚合根,收到取款交易信息验证已通过的领域事件,通知取款交易聚合根确认。 /// </summary> /// <param name="context">通知处理上下文</param> /// <param name="notification">交易信息验证已通过的领域通知</param> public void OnDomainNotification(IDomainNotifyingContext context, WithdrawTransactionValidatedDomainNotification notification) { var command = new ConfirmWithdrawTransactionValidatedDomainCommand() { AggregateRootId = notification.TransactionId }; context.PublishDomainCommand(command); }
/// <summary> /// 2.2 从银行账户聚合根,收到取款交易信息验证已失败的通知,向取款账交易聚合根发起取消交易。 /// </summary> /// <param name="context">领域通知处理上下文</param> /// <param name="notification">取款交易信息验证已失败的通知</param> public void OnDomainNotification(IDomainNotifyingContext context, WithdrawTransactionValidateFailedDomainNotification notification) { var command = new CancelWithdrawTransactionDomainCommand() { AggregateRootId = notification.TransactionId, Message = notification.Message }; context.PublishDomainCommand(command); }
/// <summary> /// 2.2 从银行账户聚合根,收到转账交易信息验证失败的通知,通知转账交易聚合根,取消交易 /// </summary> /// <param name="context">领域通知执行上下文</param> /// <param name="notification">转账交易信息验证失败的通知</param> public void OnDomainNotification(IDomainNotifyingContext context, TransferTransactionValidateFailedDomainNotification notification) { context.PublishDomainCommand(new CancelTransferTransactionDomainCommand(notification.TransactionId, notification.Message)); }
/// <summary> /// 2.1 从银行账户聚合根,收到转账交易已验证的领域通知,通知转账交易聚合根确认。 /// </summary> /// <param name="context">事件处理上下文</param> /// <param name="notification">转账交易已验证的领域通知</param> public void OnDomainNotification(IDomainNotifyingContext context, TransferTransactionValidatedDomainNotification notification) { var command = new ConfirmTransferTransactionValidatedDomainCommand(notification.TransactionId, notification.AccountType); context.PublishDomainCommand(command); }