File tree Expand file tree Collapse file tree 3 files changed +27
-27
lines changed
ApplicationCore/Configuration Expand file tree Collapse file tree 3 files changed +27
-27
lines changed Original file line number Diff line number Diff line change 1+ using Microsoft . eShopWeb . ApplicationCore . Entities . OrderAggregate . Events ;
2+ using NServiceBus ;
3+
4+ namespace Microsoft . eShopWeb . ApplicationCore . Configuration ;
5+ public static class NServiceBusConfiguration
6+ {
7+ public static EndpointConfiguration GetNServiceBusConfiguration ( )
8+ {
9+ var endpointConfiguration = new EndpointConfiguration ( "orders-worker" ) ;
10+ endpointConfiguration . UseSerialization < SystemJsonSerializer > ( ) ;
11+
12+ var transport = endpointConfiguration . UseTransport < LearningTransport > ( ) ;
13+
14+ transport . Routing ( ) . RouteToEndpoint (
15+ typeof ( OrderCreatedEvent ) ,
16+ "orders-worker" ) ;
17+
18+ endpointConfiguration . SendFailedMessagesTo ( "error" ) ;
19+ endpointConfiguration . AuditProcessedMessagesTo ( "audit" ) ;
20+
21+ return endpointConfiguration ;
22+ }
23+ }
Original file line number Diff line number Diff line change 1212using Microsoft . eShopWeb . Web . Extensions ;
1313using NServiceBus ;
1414using NimblePros . Metronome ;
15+ using Microsoft . eShopWeb . ApplicationCore . Configuration ;
1516
1617var builder = WebApplication . CreateBuilder ( args ) ;
1718
5253}
5354
5455// NServiceBus
55- builder . Host . UseNServiceBus ( _ =>
56- {
57- var endpointConfiguration = new EndpointConfiguration ( "orders-worker" ) ;
58- endpointConfiguration . UseSerialization < SystemJsonSerializer > ( ) ;
59-
60- var transport = endpointConfiguration . UseTransport < LearningTransport > ( ) ;
61-
62- transport . Routing ( ) . RouteToEndpoint (
63- typeof ( OrderCreatedEvent ) ,
64- "orders-worker" ) ;
65-
66- endpointConfiguration . SendFailedMessagesTo ( "error" ) ;
67- endpointConfiguration . AuditProcessedMessagesTo ( "audit" ) ;
68-
69- return endpointConfiguration ;
70- } ) ;
56+ builder . Host . UseNServiceBus ( config => NServiceBusConfiguration . GetNServiceBusConfiguration ( ) ) ;
7157
7258builder . Services . AddScoped < ITokenClaimsService , IdentityTokenClaimService > ( ) ;
7359builder . Services . AddCoreServices ( builder . Configuration ) ;
Original file line number Diff line number Diff line change 11using System . Text . Json ;
2+ using Microsoft . eShopWeb . ApplicationCore . Configuration ;
23using NServiceBus ;
34
45var builder = Host . CreateDefaultBuilder ( ) ;
56
67builder . UseConsoleLifetime ( ) ;
7- builder . UseNServiceBus ( context =>
8- {
9- var endpointConfiguration = new EndpointConfiguration ( "orders-worker" ) ;
10- endpointConfiguration . UseSerialization < SystemJsonSerializer > ( ) ;
11- endpointConfiguration . UseTransport < LearningTransport > ( ) ;
12-
13- endpointConfiguration . SendFailedMessagesTo ( "error" ) ;
14- endpointConfiguration . AuditProcessedMessagesTo ( "audit" ) ;
15-
16- return endpointConfiguration ;
17- } ) ;
8+ builder . UseNServiceBus ( context => NServiceBusConfiguration . GetNServiceBusConfiguration ( ) ) ;
189
1910var host = builder . Build ( ) ;
2011host . Run ( ) ;
You can’t perform that action at this time.
0 commit comments