Beispiel #1
0
        /// <summary>
        /// Subscribe to inprocess message bus.
        /// </summary>
        /// <param name="topic"></param>
        /// <param name="filter"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        /// <remarks>
        /// Stores the callback and uses the callback when SignalR calls the main callback.
        /// </remarks>
        public virtual Task Subscribe(string topic, string filter, MessageBusCallbackDelegate callback)
        {
            var subscription = new SubscriptionIdentifier(topic, filter);

            _messageDispatcher.Subscribe(subscription, callback);

            //return emtpy task
            return(TaskAsyncHelper.Empty);
        }
        /// <summary>
        /// Informs the message dispatcher of a closed subscription
        /// </summary>
        /// <param name="subscription">The subscription.</param>
        public void Unsubscribe(SubscriptionIdentifier subscription)
        {
            MessageBusCallbackDelegate temp;

            _callbacks.TryRemove(subscription, out temp);
        }
 /// <summary>
 /// Informs the message dispatcher of a new subscription
 /// </summary>
 /// <param name="subscription">The subscription.</param>
 /// <param name="callback">The callback.</param>
 public void Subscribe(SubscriptionIdentifier subscription, MessageBusCallbackDelegate callback)
 {
     _callbacks[subscription] = callback;
 }
Beispiel #4
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            SubscriptionIdentifier other = obj as SubscriptionIdentifier;

            return(other != null && other.Selector.Equals(Selector));
        }