Exemplo n.º 1
0
        public void miss()
        {
            var rule = new TopicRuleByType <Message1>(m => "wrong");

            rule.Matches(typeof(LogMessage))
            .ShouldBeFalse();
        }
Exemplo n.º 2
0
        public void hit()
        {
            var rule = new TopicRuleByType <LogMessage>(m => m.Priority);

            rule.Matches(typeof(LogMessage))
            .ShouldBeTrue();

            rule.DetermineTopicName(new LogMessage {
                Priority = "Low"
            })
            .ShouldBe("Low");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Determine a topic name for messages of type TMessage. This
        /// is meant for more complex topic routing where you may be using
        /// information about the message itself to decide how to route
        /// </summary>
        /// <param name="topicSource"></param>
        /// <typeparam name="TMessage"></typeparam>
        /// <returns></returns>
        public TopicRouterConfiguration <TSubscriberConfiguration> OutgoingTopicNameIs <TMessage>(Func <TMessage, string> topicSource)
        {
            var rule = new TopicRuleByType <TMessage>(topicSource);

            return(AddOutgoingTopicRule(rule));
        }