/// <summary> /// Creates a new subscriber and adds it to a topic. /// The subscriber will asynchronously recieve messages. /// </summary> public static MapleSub Subscribe( string outletName, params string[] topicPathParts) { // Lazy load publication data var topicOutbox = GetOrAddTopic(outletName, topicPathParts); // Add new subscription to topic var newSub = new MapleSub(); topicOutbox.Value.EnlistSub(newSub); return(newSub); }
public void EnlistSub(MapleSub sub) => SubRefs.Add(new WeakReference <MapleSub>(sub));