Skip to content

Commit 9cc1c07

Browse files
committed
#15 fix build failed
1 parent fc7177c commit 9cc1c07

File tree

7 files changed

+27
-40
lines changed

7 files changed

+27
-40
lines changed

build.cake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ var libs = new List<string>{
1919
"./src/NetCoreKit.Infrastructure.EfCore.SqlServer/NetCoreKit.Infrastructure.EfCore.SqlServer.csproj",
2020
"./src/NetCoreKit.Infrastructure.EfCore.MySql/NetCoreKit.Infrastructure.EfCore.MySql.csproj",
2121
"./src/NetCoreKit.Infrastructure.Bus/NetCoreKit.Infrastructure.Bus.csproj",
22-
"./src/NetCoreKit.Infrastructure.Bus.InProcessBus/NetCoreKit.Infrastructure.Bus.InProcessBus.csproj",
2322
"./src/NetCoreKit.Infrastructure.Bus.Kafka/NetCoreKit.Infrastructure.Bus.Kafka.csproj"
2423
};
2524

samples/SignalRNotifier/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
1919
{
2020
services.AddMediatR(
2121
typeof(Startup),
22-
typeof(DomainDomainEventBus)
22+
typeof(DomainEventBus)
2323
/*typeof(ProjectCreated)*/);
2424

2525
Mapper.Initialize(cfg => cfg.AddProfiles(typeof(Startup)));

samples/TodoApi/Startup.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public void ConfigureServices(IServiceCollection services)
2323
},
2424
(svc, _) => { svc.AddScoped<IUserGateway, UserGateway>(); }
2525
);
26-
2726
}
2827

2928
public void Configure(IApplicationBuilder app)

samples/TodoApi/v1/Services/KafkaEnvelopeEventHandler.cs

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

samples/TodoApi/v1/UseCases/CreateProject/RequestHandler.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
using System.Threading.Tasks;
33
using MediatR;
44
using NetCoreKit.Domain;
5+
using NetCoreKit.Infrastructure.Bus;
6+
using NetCoreKit.Infrastructure.Bus.Kafka;
7+
using NetCoreKit.Infrastructure.Mappers;
58
using NetCoreKit.Samples.TodoAPI.Domain;
69
using NetCoreKit.Samples.TodoAPI.Extensions;
10+
using Project.Proto;
11+
using Task = System.Threading.Tasks.Task;
712

813
namespace NetCoreKit.Samples.TodoAPI.v1.UseCases.CreateProject
914
{
@@ -27,6 +32,24 @@ public async Task<CreateProjectResponse> Handle(CreateProjectRequest request,
2732
}
2833
}
2934

35+
public class KafkaEnvelopeEventHandler : INotificationHandler<NotificationEnvelope>
36+
{
37+
private readonly IDispatchedEventBus _eventBus;
38+
39+
public KafkaEnvelopeEventHandler(IDispatchedEventBus eventBus)
40+
{
41+
_eventBus = eventBus;
42+
}
43+
44+
public async Task Handle(NotificationEnvelope notify, CancellationToken cancellationToken)
45+
{
46+
if (!(notify.Event is ProjectCreated)) return;
47+
48+
var msg = notify.Event.MapTo<IEvent, ProjectCreatedMsg>();
49+
await _eventBus.Publish(msg, "project");
50+
}
51+
}
52+
3053
public class EventSubscriber : INotificationHandler<ProjectCreated>
3154
{
3255
public async System.Threading.Tasks.Task Handle(ProjectCreated @event, CancellationToken cancellationToken)

src/NetCoreKit.Infrastructure.Bus/DomainDomainEventBus.cs renamed to src/NetCoreKit.Infrastructure.Bus/DomainEventBus.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
namespace NetCoreKit.Infrastructure.Bus
77
{
8-
public class DomainDomainEventBus : IDomainEventBus
8+
public class DomainEventBus : IDomainEventBus
99
{
1010
private readonly IMediator _mediator;
1111

12-
public DomainDomainEventBus(IMediator mediator)
12+
public DomainEventBus(IMediator mediator)
1313
{
1414
_mediator = mediator;
1515
}

src/NetCoreKit.Infrastructure.Bus/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public static class ServiceCollectionExtensions
77
{
88
public static IServiceCollection AddDomainEventBus(this IServiceCollection services)
99
{
10-
services.AddSingleton<IDomainEventBus, DomainDomainEventBus>();
10+
services.AddSingleton<IDomainEventBus, DomainEventBus>();
1111
return services;
1212
}
1313
}

0 commit comments

Comments
 (0)