Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
 public void EnlistSub(MapleSub sub) =>
 SubRefs.Add(new WeakReference <MapleSub>(sub));