Skip to content

Commit a56f99f

Browse files
committed
Fix merge
1 parent a3e63c1 commit a56f99f

8 files changed

Lines changed: 64 additions & 80 deletions

File tree

eShopOnContainers-ServicesAndWebApps.sln

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26430.12
4+
VisualStudioVersion = 15.0.26430.13
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{932D8224-11F6-4D07-B109-DA28AD288A63}"
77
EndProject
@@ -1264,54 +1264,6 @@ Global
12641264
{DF395F85-B010-465D-857A-7EBCC512C0C2}.Release|x64.Build.0 = Release|Any CPU
12651265
{DF395F85-B010-465D-857A-7EBCC512C0C2}.Release|x86.ActiveCfg = Release|Any CPU
12661266
{DF395F85-B010-465D-857A-7EBCC512C0C2}.Release|x86.Build.0 = Release|Any CPU
1267-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
1268-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
1269-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
1270-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
1271-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
1272-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
1273-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
1274-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
1275-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
1276-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
1277-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
1278-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
1279-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
1280-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|Any CPU.Build.0 = Debug|Any CPU
1281-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|ARM.ActiveCfg = Debug|Any CPU
1282-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|ARM.Build.0 = Debug|Any CPU
1283-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
1284-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|iPhone.Build.0 = Debug|Any CPU
1285-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
1286-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
1287-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|x64.ActiveCfg = Debug|Any CPU
1288-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|x64.Build.0 = Debug|Any CPU
1289-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|x86.ActiveCfg = Debug|Any CPU
1290-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.AppStore|x86.Build.0 = Debug|Any CPU
1291-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1292-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
1293-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|ARM.ActiveCfg = Debug|Any CPU
1294-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|ARM.Build.0 = Debug|Any CPU
1295-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|iPhone.ActiveCfg = Debug|Any CPU
1296-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|iPhone.Build.0 = Debug|Any CPU
1297-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
1298-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
1299-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|x64.ActiveCfg = Debug|Any CPU
1300-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|x64.Build.0 = Debug|Any CPU
1301-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|x86.ActiveCfg = Debug|Any CPU
1302-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Debug|x86.Build.0 = Debug|Any CPU
1303-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
1304-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|Any CPU.Build.0 = Release|Any CPU
1305-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|ARM.ActiveCfg = Release|Any CPU
1306-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|ARM.Build.0 = Release|Any CPU
1307-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|iPhone.ActiveCfg = Release|Any CPU
1308-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|iPhone.Build.0 = Release|Any CPU
1309-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
1310-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
1311-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|x64.ActiveCfg = Release|Any CPU
1312-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|x64.Build.0 = Release|Any CPU
1313-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|x86.ActiveCfg = Release|Any CPU
1314-
{89D80DF1-32E1-4AAF-970F-DA0AA6881F9D}.Release|x86.Build.0 = Release|Any CPU
13151267
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
13161268
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
13171269
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
@@ -1406,5 +1358,6 @@ Global
14061358
{23A33F9B-7672-426D-ACF9-FF8436ADC81A} = {88B22DBB-AA8F-4290-A454-2C109352C345}
14071359
{A5260DE0-1FDD-467E-9CC1-A028AB081CEE} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8}
14081360
{DF395F85-B010-465D-857A-7EBCC512C0C2} = {A5260DE0-1FDD-467E-9CC1-A028AB081CEE}
1361+
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F}
14091362
EndGlobalSection
14101363
EndGlobal

src/BuildingBlocks/EventBus/EventBus/EventBus.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13+
<PackageReference Include="Autofac" Version="4.5.0" />
1314
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
1415
</ItemGroup>
1516

src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,29 @@
1111
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
1212
using System.Reflection;
1313
using Microsoft.Azure.ServiceBus.Filters;
14+
using Autofac;
15+
using Newtonsoft.Json.Linq;
1416

1517
public class EventBusServiceBus : IEventBus
1618
{
1719
private readonly IServiceBusPersisterConnection _serviceBusPersisterConnection;
18-
private ServiceBusConnectionStringBuilder _serviceBusConnectionStringBuilder;
1920
private readonly ILogger<EventBusServiceBus> _logger;
2021
private readonly IEventBusSubscriptionsManager _subsManager;
2122
private readonly SubscriptionClient _subscriptionClient;
22-
23+
private readonly ILifetimeScope _autofac;
24+
private readonly string AUTOFAC_SCOPE_NAME = "eshop_event_bus";
25+
2326
public EventBusServiceBus(IServiceBusPersisterConnection serviceBusPersisterConnection,
24-
ILogger<EventBusServiceBus> logger, IEventBusSubscriptionsManager subsManager, string subscriptionClientName)
27+
ILogger<EventBusServiceBus> logger, IEventBusSubscriptionsManager subsManager, string subscriptionClientName,
28+
ILifetimeScope autofac)
2529
{
2630
_serviceBusPersisterConnection = serviceBusPersisterConnection;
2731
_logger = logger;
2832
_subsManager = subsManager ?? new InMemoryEventBusSubscriptionsManager();
2933

3034
_subscriptionClient = new SubscriptionClient(serviceBusPersisterConnection.ServiceBusConnectionStringBuilder,
3135
subscriptionClientName);
36+
_autofac = autofac;
3237

3338
RemoveDefaultRule();
3439
RegisterSubscriptionClientMessageHandler();
@@ -54,7 +59,13 @@ public void Publish(IntegrationEvent @event)
5459
.GetResult();
5560
}
5661

57-
public void Subscribe<T, TH>(Func<TH> handler)
62+
public void SubscribeDynamic<TH>(string eventName)
63+
where TH : IDynamicIntegrationEventHandler
64+
{
65+
_subsManager.AddDynamicSubscription<TH>(eventName);
66+
}
67+
68+
public void Subscribe<T, TH>()
5869
where T : IntegrationEvent
5970
where TH : IIntegrationEventHandler<T>
6071
{
@@ -76,7 +87,7 @@ public void Subscribe<T, TH>(Func<TH> handler)
7687
}
7788
}
7889

79-
_subsManager.AddSubscription<T, TH>(handler);
90+
_subsManager.AddSubscription<T, TH>();
8091
}
8192

8293
public void Unsubscribe<T, TH>()
@@ -100,6 +111,12 @@ public void Unsubscribe<T, TH>()
100111
_subsManager.RemoveSubscription<T, TH>();
101112
}
102113

114+
public void UnsubscribeDynamic<TH>(string eventName)
115+
where TH : IDynamicIntegrationEventHandler
116+
{
117+
_subsManager.RemoveDynamicSubscription<TH>(eventName);
118+
}
119+
103120
public void Dispose()
104121
{
105122
_subsManager.Clear();
@@ -121,15 +138,26 @@ private async Task ProcessEvent(string eventName, string message)
121138
{
122139
if (_subsManager.HasSubscriptionsForEvent(eventName))
123140
{
124-
var eventType = _subsManager.GetEventTypeByName(eventName);
125-
var integrationEvent = JsonConvert.DeserializeObject(message, eventType);
126-
var handlers = _subsManager.GetHandlersForEvent(eventName);
127-
128-
foreach (var handlerfactory in handlers)
141+
using (var scope = _autofac.BeginLifetimeScope(AUTOFAC_SCOPE_NAME))
129142
{
130-
var handler = handlerfactory.DynamicInvoke();
131-
var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(eventType);
132-
await (Task)concreteType.GetMethod("Handle").Invoke(handler, new object[] { integrationEvent });
143+
var subscriptions = _subsManager.GetHandlersForEvent(eventName);
144+
foreach (var subscription in subscriptions)
145+
{
146+
if (subscription.IsDynamic)
147+
{
148+
var handler = scope.ResolveOptional(subscription.HandlerType) as IDynamicIntegrationEventHandler;
149+
dynamic eventData = JObject.Parse(message);
150+
await handler.Handle(eventData);
151+
}
152+
else
153+
{
154+
var eventType = _subsManager.GetEventTypeByName(eventName);
155+
var integrationEvent = JsonConvert.DeserializeObject(message, eventType);
156+
var handler = scope.ResolveOptional(subscription.HandlerType);
157+
var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(eventType);
158+
await (Task)concreteType.GetMethod("Handle").Invoke(handler, new object[] { integrationEvent });
159+
}
160+
}
133161
}
134162
}
135163
}

src/Services/Basket/Basket.API/Startup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,13 @@ private void RegisterEventBus(IServiceCollection services)
145145
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
146146
{
147147
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
148+
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
148149
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
149150
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
150151
var subscriptionClientName = Configuration["SubscriptionClientName"];
151152

152153
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
153-
eventBusSubcriptionsManager, subscriptionClientName);
154+
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
154155
});
155156
}
156157
else

src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,19 @@ static IEnumerable<CatalogItem> GetPreconfiguredItems()
7070
{
7171
return new List<CatalogItem>()
7272
{
73-
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Bot Black Hoodie", Name = ".NET Bot Black Hoodie", Price = 19.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/1", AvailableStock = 100},
74-
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/2", AvailableStock = 100 },
75-
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/3", AvailableStock = 100 },
76-
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Foundation T-shirt", Name = ".NET Foundation T-shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/4", AvailableStock = 100 },
77-
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/5", AvailableStock = 100 },
78-
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Blue Hoodie", Name = ".NET Blue Hoodie", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/6", AvailableStock = 100 },
79-
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/7", AvailableStock = 100 },
80-
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Kudu Purple Hoodie", Name = "Kudu Purple Hoodie", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/8", AvailableStock = 100 },
81-
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, Description = "Cup<T> White Mug", Name = "Cup<T> White Mug", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/9", AvailableStock = 100 },
82-
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/10", AvailableStock = 100 },
83-
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = "Cup<T> Sheet", Name = "Cup<T> Sheet", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/11", AvailableStock = 100 },
84-
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/12", AvailableStock = 100 }
85-
};
73+
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, PictureFileName = "1.png", Description = ".NET Bot Black Hoodie", Name = ".NET Bot Black Hoodie", Price = 19.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/1", AvailableStock = 100},
74+
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, PictureFileName = "2.png", Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/2", AvailableStock = 100 },
75+
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, PictureFileName = "3.png", Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/3", AvailableStock = 100 },
76+
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, PictureFileName = "4.png", Description = ".NET Foundation T-shirt", Name = ".NET Foundation T-shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/4", AvailableStock = 100 },
77+
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, PictureFileName = "5.png", Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/5", AvailableStock = 100 },
78+
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, PictureFileName = "6.png", Description = ".NET Blue Hoodie", Name = ".NET Blue Hoodie", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/6", AvailableStock = 100 },
79+
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, PictureFileName = "7.png", Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/7", AvailableStock = 100 },
80+
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, PictureFileName = "8.png", Description = "Kudu Purple Hoodie", Name = "Kudu Purple Hoodie", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/8", AvailableStock = 100 },
81+
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, PictureFileName = "9.png", Description = "Cup<T> White Mug", Name = "Cup<T> White Mug", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/9", AvailableStock = 100 },
82+
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, PictureFileName = "10.png", Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/10", AvailableStock = 100 },
83+
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, PictureFileName = "11.png", Description = "Cup<T> Sheet", Name = "Cup<T> Sheet", Price = 8.5M, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/11", AvailableStock = 100 },
84+
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, PictureFileName = "12.png", Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/pic/12", AvailableStock = 100 }
85+
};
8686
}
8787
}
8888
}

src/Services/Catalog/Catalog.API/Startup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,13 @@ private void RegisterEventBus(IServiceCollection services)
214214
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
215215
{
216216
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
217+
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
217218
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
218219
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
219220
var subscriptionClientName = Configuration["SubscriptionClientName"];
220221

221222
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
222-
eventBusSubcriptionsManager, subscriptionClientName);
223+
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
223224
});
224225

225226
}

src/Services/Catalog/Catalog.API/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
}
1111
},
1212
"AzureServiceBusEnabled": false,
13-
"AzureStorageEnabled": false,
13+
"AzureStorageEnabled": true,
1414
"SubscriptionClientName": "Catalog"
1515
}

src/Services/Ordering/Ordering.API/Startup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
178178
});
179179

180180
WaitForSqlAvailabilityAsync(loggerFactory, app).Wait();
181-
ConfigureEventBus(app);
182181

183182
var integrationEventLogContext = new IntegrationEventLogContext(
184183
new DbContextOptionsBuilder<IntegrationEventLogContext>()
@@ -219,12 +218,13 @@ private void RegisterEventBus(IServiceCollection services)
219218
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
220219
{
221220
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
221+
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
222222
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
223223
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
224224
var subscriptionClientName = Configuration["SubscriptionClientName"];
225225

226226
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
227-
eventBusSubcriptionsManager, subscriptionClientName);
227+
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
228228
});
229229
}
230230
else

0 commit comments

Comments
 (0)