public void miss() { var rule = new TopicRuleByType <Message1>(m => "wrong"); rule.Matches(typeof(LogMessage)) .ShouldBeFalse(); }
public void hit() { var rule = new TopicRuleByType <LogMessage>(m => m.Priority); rule.Matches(typeof(LogMessage)) .ShouldBeTrue(); rule.DetermineTopicName(new LogMessage { Priority = "Low" }) .ShouldBe("Low"); }
/// <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)); }