Beispiel #1
0
        /// <summary>
        /// Publishes the specified message, invoking any handlers subscribed to
        /// the message.
        /// </summary>
        /// <typeparam name="TMessage">Message type. This should be a simple serializable object</typeparam>
        /// <param name="message">The message to publish</param>
        public async Task PublishAsync <TMessage>(TMessage message) where TMessage : class
        {
            var subs = _state.GetSubscriptionsFor <TMessage>();

            foreach (var subscription in subs)
            {
                await subscription.DeliverAsync(_serviceProvider, message);
            }
        }
        /// <summary>
        /// Publishes the specified message, invoking any handlers subscribed to
        /// the message.
        /// </summary>
        /// <typeparam name="TMessage">Message type. This should be a simple serializable object</typeparam>
        /// <param name="message">The message to publish</param>
        public async Task PublishAsync <TMessage>(TMessage message) where TMessage : class
        {
            var subs = _state.GetSubscriptionsFor <TMessage>();

            foreach (var subscription in subs)
            {
                await subscription.DeliverAsync(_resolutionContext, message);
            }
        }