예제 #1
0
        private static IRoutingEntry GetRoutingEntry(IRoutingKey routingKey, IRoutingLookupFactory factory, IRoutingDiagnostics diagnostics)
        {
            IRoutingLookup lookupForType = factory.GetLookupForType(routingKey.RoutingItemType);
            IRoutingEntry  routingEntry  = null;

            if (lookupForType != null)
            {
                routingEntry = lookupForType.GetRoutingEntry(routingKey, diagnostics);
                if (routingEntry != null && (routingEntry.Destination.RoutingItemType == RoutingItemType.Error || routingEntry.Destination.RoutingItemType == RoutingItemType.Unknown))
                {
                    routingEntry = null;
                }
            }
            return(routingEntry);
        }
예제 #2
0
        internal IEnumerable <string> GetRoutingUpdates(IEnumerable <IRoutingEntry> routingEntries)
        {
            if (routingEntries == null)
            {
                throw new ArgumentNullException("routingEntries");
            }
            List <string> list = new List <string>();

            foreach (IRoutingEntry routingEntry in routingEntries)
            {
                IRoutingLookup lookupForType = this.lookupFactory.GetLookupForType(routingEntry.Key.RoutingItemType);
                if (lookupForType != null)
                {
                    IRoutingEntry routingEntry2 = lookupForType.GetRoutingEntry(routingEntry.Key, this.diagnostics);
                    if (routingEntry2 != null && this.ShouldSendRoutingEntryUpdate(routingEntry, routingEntry2))
                    {
                        list.Add(RoutingEntryHeaderSerializer.Serialize(routingEntry2));
                    }
                }
            }
            return(list);
        }