项目地址
dbt
airflow
一、事件通知
二、数据状态迁移

- 模块下的
IntegrationEvents
这个模块是专门用来负责数据状态迁移,一般是用来,同步到CRM系统或是邮件系统
2.1 UserRegisteredIntegrationEvent
1. 创建UserRegisteredIntegrationEvent(Users)
namespace Evently.Modules.Users.IntegrationEvents;
public sealed class UserRegisteredIntegrationEvent
: IntegrationEvent
{
public UserRegisteredIntegrationEvent(
Guid id,
DateTime occurredOnUtc,
Guid userId,
string email,
string firstName,
string lastName)
: base(id, occurredOnUtc)
{
UserId = userId;
Email = email;
FirstName = firstName;
LastName = lastName;
}
public Guid UserId {
get; init; }
public string Email {
get; init; }
public string FirstName {
get; init; }
public string LastName {
get; init; }
}
2. UserRegisteredIntegrationEvent进行发布(Users)
- 这里发布的是上面的UserRegisteredIntegrationEvent

3. UserRegisteredIntegrationEventHandler(消费者模块)
- 所有需要用到该数据的模块,都需要创建UserRegisteredIntegrationEventHandler,该系统中Ticketing和
namespace Evently.Modules.Ticketing.Presentation.Customers;
internal sealed class UserRegisteredIntegrationEventHandler(ISender sender)
: IntegrationEventHandler<UserRegisteredIntegrationEvent>
{
public override async Task Handle(
UserRegisteredIntegrationEvent integrationEvent,
CancellationToken cancellationToken = default)
{
Result result = await sender.Send(
new CreateCustomerCommand(
integrationEvent.UserId,
integrationEvent.Email,
integrationEvent.FirstName,
integrationEvent.LastName),
cancellationToken);
if (result.IsFailure)
{
throw new EventlyException(nameof(CreateCustomerCommand), result.Error);
}
}
}
namespace Evently.Modules.Attendance.Presentation.Attendees;
internal sealed class UserRegisteredIntegrationEventHandler(ISender sender)
: IntegrationEventHandler<UserRegistere