Add PubSub service modules designed for Dependency Injection
* Get rid of JsonPropertyName attributes in PubSubConfig
- The Dependency Injection framework (based around dotnet ApplicationBuilder)
does not support this attribute, and maps property names verbatim to json fields.
* Change PubSubServer json fields to match cs class property names verbatim
This commit is contained in:
1 parent
83cbb0f47f
commit
b4cb6ac856
42 files changed
+1018
-362
No files matched your search
@@ -8,6 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.24.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.7" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="OpenAI" Version="2.0.0" />
|
||||
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace Bts.DataStreamCore.Services;
|
||||
|
||||
using BCG;
|
||||
using BCG.Utilities.General;
|
||||
|
||||
using Bts.PubSub.Services;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
public static class DataStreamCoreServices {
|
||||
public static IServiceCollection AddPubTableBroker(this IServiceCollection services) =>
|
||||
services.AddSingleton<IPubTableBroker, PubTableBroker>();
|
||||
|
||||
public static IServiceCollection AddViewStreamDatabase(this IServiceCollection services, IConfiguration configurationSection) =>
|
||||
services.Configure<WorkerServiceConfig>(configurationSection)
|
||||
.AddSingleton<IWorker, ViewStreamDatabase>(sp => {
|
||||
ViewStreamDatabase.SetGlobalInstance(new ViewStreamDatabase(sp.GetRequiredService<ISubscriberCore>()));
|
||||
return ViewStreamDatabase.instance;
|
||||
});
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using System.Threading;
|
||||
using mbts;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using bts;
|
||||
|
||||
namespace BCG {
|
||||
public class ViewStreamDatabase : IWorker, IDisposable {
|
||||
@@ -230,6 +231,11 @@ namespace BCG {
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetGlobalInstance(ViewStreamDatabase vsd) {
|
||||
Log.isnull(mySelf);
|
||||
mySelf = vsd;
|
||||
}
|
||||
|
||||
private List<PendingAddRemoveWorker> _pending_worker_ops = new List<PendingAddRemoveWorker>();
|
||||
private bool _is_worker_call_in_progress = false;
|
||||
class PendingAddRemoveWorker {
|
||||
|
||||
Reference in new issue
Block a user