Skip to content

Commit 8139abe

Browse files
authored
feat:update event (#719)
* fix:优化 * 1 * feat:add Aggregate root object creation, modification, and deletion events * feat:optimization topic default value * feat:init event * feat:test bulkevent * feat:update BulkMarkEventAsInProgress * fix:IntegrationEvents.Tests.Infrastructure.CustomIntegrationEventLogService * fix:resolve conflicts * feat:remove test api * fix:DefaultUserContext * fix:optimization * fix:取消集成事件默认Topic,可能引起命名冲突优化 * fix:remove backup.csproj * fix:TestEntityCreatedEventAsync
1 parent 31f9fe4 commit 8139abe

File tree

31 files changed

+823
-68
lines changed

31 files changed

+823
-68
lines changed

src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Masa - Backup.BuildingBlocks.Authentication.OpenIdConnect.Domain.csproj

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/BuildingBlocks/Ddd/Domain/Masa.BuildingBlocks.Ddd.Domain.Tests/EventTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) MASA Stack All rights reserved.
1+
// Copyright (c) MASA Stack All rights reserved.
22
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
33

44
namespace Masa.BuildingBlocks.Ddd.Domain.Tests;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) MASA Stack All rights reserved.
2+
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
3+
4+
namespace Masa.BuildingBlocks.Ddd.Domain.Events
5+
{
6+
public abstract record class EntityChangedEvent<TEntity> : DomainCommand
7+
{
8+
public TEntity Entity { get; set; }
9+
10+
public EntityChangedEvent(TEntity entity)
11+
{
12+
Entity = entity;
13+
}
14+
}
15+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) MASA Stack All rights reserved.
2+
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
3+
4+
namespace Masa.BuildingBlocks.Ddd.Domain.Events
5+
{
6+
public record class EntityCreatedDomainEvent<TEntity> : EntityChangedEvent<TEntity>
7+
{
8+
public EntityCreatedDomainEvent(TEntity entity) : base(entity)
9+
{
10+
}
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) MASA Stack All rights reserved.
2+
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
3+
4+
namespace Masa.BuildingBlocks.Ddd.Domain.Events
5+
{
6+
public record class EntityDeletedDomainEvent<TEntity> : EntityChangedEvent<TEntity>
7+
{
8+
public EntityDeletedDomainEvent(TEntity entity) : base(entity)
9+
{
10+
}
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) MASA Stack All rights reserved.
2+
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
3+
4+
namespace Masa.BuildingBlocks.Ddd.Domain.Events
5+
{
6+
public record class EntityModifiedDomainEvent<TEntity> : EntityChangedEvent<TEntity>
7+
{
8+
public EntityModifiedDomainEvent(TEntity entity) : base(entity)
9+
{
10+
}
11+
}
12+
}

src/BuildingBlocks/Development/Masa.BuildingBlocks.Development.DaprStarter/Masa - Backup.BuildingBlocks.Development.DaprStarters.csproj

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/BuildingBlocks/Dispatcher/Masa.BuildingBlocks.Dispatcher.IntegrationEvents/IntegrationEvent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ namespace Masa.BuildingBlocks.Dispatcher.IntegrationEvents;
55

66
public abstract record IntegrationEvent : IIntegrationEvent
77
{
8-
[JsonInclude]public Guid EventId { private get; set; }
8+
[JsonInclude] public Guid EventId { private get; set; }
99

1010
[JsonInclude]
1111
public DateTime EvenCreateTime { private get; set; }
1212

13-
[NotMapped] [JsonIgnore] public IUnitOfWork? UnitOfWork { get; set; }
13+
[NotMapped][JsonIgnore] public IUnitOfWork? UnitOfWork { get; set; }
1414

1515
public virtual string Topic { get; set; }
1616

src/BuildingBlocks/Dispatcher/Masa.BuildingBlocks.Dispatcher.IntegrationEvents/Logs/IIntegrationEventLogService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@ Task SaveEventAsync(
3737

3838
Task MarkEventAsPublishedAsync(Guid eventId, CancellationToken cancellationToken = default);
3939

40+
Task<List<Guid>> BulkMarkEventAsPublishedAsync(IEnumerable<Guid> eventIds, CancellationToken cancellationToken = default);
41+
4042
Task MarkEventAsInProgressAsync(Guid eventId, int minimumRetryInterval, CancellationToken cancellationToken = default);
4143

44+
Task<List<Guid>> BulkMarkEventAsInProgressAsync(IEnumerable<Guid> eventIds, int minimumRetryInterval, CancellationToken cancellationToken = default);
45+
4246
Task MarkEventAsFailedAsync(Guid eventId, CancellationToken cancellationToken = default);
4347

48+
Task<List<Guid>> BulkMarkEventAsFailedAsync(IEnumerable<Guid> eventIds, CancellationToken cancellationToken = default);
49+
4450
/// <summary>
4551
/// Delete successfully published and expired data
4652
/// </summary>

src/BuildingBlocks/Exception/Masa.BuildingBlocks.Exceptions.Tests/UserFriendlyExceptionTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
// Copyright (c) MASA Stack All rights reserved.
1+
// Copyright (c) MASA Stack All rights reserved.
22
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
33

4+
using Microsoft.Extensions.Logging;
5+
46
namespace Masa.BuildingBlocks.Exceptions.Tests;
57

68
[TestClass]

0 commit comments

Comments
 (0)