refactor: Decouple ManagedSubscriber from ISubscriberCore impl
This commit is contained in:
1 parent
41cd59e6f9
commit
4e6d1a2335
1 file changed
+6
-2
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
|
||||
using BCG.Utilities.General;
|
||||
|
||||
using Bts.PubSub;
|
||||
|
||||
using OnData = System.Action<string, byte[]>;
|
||||
|
||||
@@ -18,7 +19,7 @@ namespace BCG {
|
||||
/// </summary>
|
||||
public class ManagedSubscriber : IWorker, IDisposable {
|
||||
private static ManagedSubscriber? _self;
|
||||
private SubscriberCore _subcore;
|
||||
private ISubscriberCore _subcore;
|
||||
// private IDictionary myTypedDispatchTable = new Hashtable(),
|
||||
// myRawDispatchTable = new Hashtable();
|
||||
private Dictionary<string, List<OnData>> _dispatch_table = new Dictionary<string, List<OnData>>();
|
||||
@@ -26,7 +27,7 @@ namespace BCG {
|
||||
|
||||
public ManagedSubscriber() : this(new SubscriberCore()) { }
|
||||
|
||||
public ManagedSubscriber(SubscriberCore subsCore) { _subcore = subsCore; }
|
||||
public ManagedSubscriber(ISubscriberCore subsCore) { _subcore = subsCore; }
|
||||
|
||||
public void doWork() {
|
||||
var msg_map = new Dictionary<string, List<bts.PubSubServerMessage>>();
|
||||
@@ -82,6 +83,9 @@ namespace BCG {
|
||||
}
|
||||
}
|
||||
|
||||
void IManagedSubscriber.Subscribe(string tag, OnData onData) =>
|
||||
subscribe(tag, onData);
|
||||
|
||||
private void _fire_events(IEnumerable<bts.PubSubServerMessage> updates) {
|
||||
// TODO
|
||||
foreach (var u in updates) {
|
||||
|
||||
Reference in new issue
Block a user