コード例 #1
0
        public void Publish(object message)
        {
            if (SubscriptionStorage == null)
            {
                throw new InvalidOperationException("Cannot publish - no subscription storage has been configured.");
            }

            var fullTypes   = MessageMapper.GetMessageTypeHierarchy(message.GetType());
            var subscribers = SubscriptionStorage
                              .GetSubscribersForMessage(fullTypes)
                              .ToList();

            if (!subscribers.Any())
            {
                return;
            }

            if (subscribers.Any())
            {
                SendInternal(message, subscribers);
            }
        }