public TopicRoute(ITopicRule rule, WriterCollection <IMessageSerializer> writers, ITopicRouter router, IMessagingRoot root, MessageTypeRouting messageTypeRouting) { _rule = rule; _writers = writers; _router = router; _root = root; _messageTypeRouting = messageTypeRouting; }
public StaticRoute(ISendingAgent agent, WriterCollection <IMessageSerializer> writers, MessageTypeRouting routing) { _agent = agent; _endpoint = agent.Endpoint; _writers = writers; _routing = routing; // TODO -- select the right serializer for the endpoint // hard-coding to JSON for now _writer = writers.ChooseWriter("application/json"); }
public override void AddRoute(MessageTypeRouting routing, IMessagingRoot root) { var messageType = routing.MessageType; var rule = TopicRules.FirstOrDefault(x => x.Matches(messageType)); if (rule == null) { var topicName = DetermineTopicName(messageType); var uri = BuildUriForTopic(topicName); var agent = root.Runtime.GetOrBuildSendingAgent(uri); agent.Endpoint.AddRoute(routing, root); } else { routing.AddTopicRoute(rule, this); } }
public MessageTypeRouting RouteByType(Type messageType) { var routing = new MessageTypeRouting(messageType, _root); var subscribers = _root.Runtime .FindSubscribersForMessageType(messageType); if (subscribers.Any()) { foreach (var subscriber in subscribers) { subscriber.AddRoute(routing, _root); } } else if (_root.Options.HandlerGraph.CanHandle(messageType)) { routing.UseLocalQueueAsRoute(); } return(routing); }
public abstract void AddRoute(MessageTypeRouting routing, IMessagingRoot root);