Add config for PubSub tag handler factory
This commit is contained in:
1 parent
0b8643ac8e
commit
2d9243959d
3 files changed
+26
-4
No files matched your search
@@ -58,6 +58,7 @@ public class PubSubConfig {
|
||||
public PubSubRoutingConfig? Routing { get; set; }
|
||||
public List<PubSubRoute>? PublisherRoutes => Routing?.PublisherRoutes;
|
||||
public List<PubSubRoute>? SubscriberRoutes => Routing?.SubscriberRoutes;
|
||||
public PubSubTagHandlerFactoryConfig? TagHandlerFactory { get; set; }
|
||||
|
||||
public static PubSubConfig Default() {
|
||||
const string NOTAGS = "^NOTAGS$";
|
||||
|
||||
@@ -30,8 +30,10 @@ public static class PubSubServices {
|
||||
public static IServiceCollection AddPublisherCore(this IServiceCollection services) =>
|
||||
services.AddSingleton<IPublisherCore, PublisherCore>();
|
||||
|
||||
public static IServiceCollection AddPubSubTagHandlerFactory(this IServiceCollection services) =>
|
||||
services.AddSingleton<IPubSubTagHandlerFactory, PubsubTagHandlerFactory>();
|
||||
public static IServiceCollection AddPubSubTagHandlerFactory(this IServiceCollection services, IConfiguration configurationSection) =>
|
||||
services
|
||||
.Configure<PubSubTagHandlerFactoryConfig>(configurationSection)
|
||||
.AddSingleton<IPubSubTagHandlerFactory, PubsubTagHandlerFactory>();
|
||||
|
||||
public static IServiceCollection AddSubscriberCore(this IServiceCollection services) =>
|
||||
services.AddSingleton<ISubscriberCore, SubscriberCore>();
|
||||
@@ -52,7 +54,7 @@ public static class PubSubServices {
|
||||
services
|
||||
.Configure<PubSubConfig>(configurationSection)
|
||||
.AddInternalPublisher()
|
||||
.AddPubSubTagHandlerFactory()
|
||||
.AddPubSubTagHandlerFactory(configurationSection.GetSection(nameof(PubSubConfig.TagHandlerFactory)))
|
||||
.AddSingleton<IPubSubState, PubSubState>()
|
||||
.AddSingleton<IPubSubRouter, PubSubRouter>()
|
||||
.AddPublisherCore()
|
||||
|
||||
@@ -65,6 +65,25 @@
|
||||
"UsePrepublishedServerState": false,
|
||||
"IpTranslation": null,
|
||||
"GcActivationThreshold": 0,
|
||||
"WaitPeriodAfterGc": 1000
|
||||
"WaitPeriodAfterGc": 1000,
|
||||
"TagHandlerFactory": {
|
||||
"Handlers": [
|
||||
{
|
||||
"TagType": "DataStream",
|
||||
"Assembly": "DataStreamCore",
|
||||
"Class": "bts.PubsubServerStreamTagHandler"
|
||||
},
|
||||
{
|
||||
"TagType": "System_Sub",
|
||||
"Assembly": "PubSub",
|
||||
"Class": "BCG.SystemSubscriptionMapPublisher"
|
||||
},
|
||||
{
|
||||
"TagType": "System_Stats",
|
||||
"Assembly": "PubSub",
|
||||
"Class": "BCG.SystemStatsPublisher"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user