Namely, in DataStreamPublisher and PubSubServer. This is part of a broader paradigm shift towards Dependency Injection and Factory Pattern. https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection-guidelines * Use interfaces to decouple services: - Decouple ManagedSubscriber from ISubscriberCore impl - Decouple PubTableBroker from IPublisherCore impl - Decouple RemoteQueryManager from IManagedSubscriber, IPubTableBroker impl * Rename Publishers -> PublisherNodes in DataStreamPublisherConfig * Model config profiles after dotnet appsettings - Rename Configurations/<name>.json -> appsettings.<name>.json - Make json fields match corresponding csharp props verbatim * The Dependency Injection framework doesn't support JsonPropertyName attributes. Config class props must match json fields verbatim. * Move reusable startup code into new Bts.Extensions.Hosting proj * Add pubsub and md-publisher services to compose.yaml
34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
namespace Bts.PubSub.Server;
|
|
|
|
using BCG;
|
|
|
|
using mbts;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
public delegate void PubSubStateSingleTagChangeDelegate(PubSubSingleTagStateEvent theEvent);
|
|
public delegate void PubSubStateChangeDelegate(string[] tags);
|
|
public delegate void PubSubStatsDelegate(string tag, int size);
|
|
|
|
public interface IPubSubState {
|
|
event PubSubStateChangeDelegate? onTagMapChanged;
|
|
event PubSubStatsDelegate? onPublishStats;
|
|
|
|
ICollection<string> all_tags { get; }
|
|
|
|
byte[] get_content(string tag);
|
|
string getTagType(string tag);
|
|
void get_all_connections(
|
|
string tag,
|
|
out Dictionary<string, string> subscribers,
|
|
out Dictionary<string, string> activePublishers,
|
|
out ICollection<Pair<string, string>> deadPublishers);
|
|
|
|
ICollection<string> get_subscriber_connections_for_tag(string tag);
|
|
|
|
void remove_connection(string connection);
|
|
void update_pub_data(bts.PublishMsg pub_msg);
|
|
void handle_sub(bts.SubscribeMsg sub_msg);
|
|
void handle_unsub(bts.UnsubscribeMsg unsub_msg);
|
|
}
|