Exemplo n.º 1
0
        IRoutingEntry IRoutingLookup.GetRoutingEntry(IRoutingKey routingKey, IRoutingDiagnostics diagnostics)
        {
            if (routingKey == null)
            {
                throw new ArgumentNullException("routingKey");
            }
            if (diagnostics == null)
            {
                throw new ArgumentNullException("diagnostics");
            }
            T t = routingKey as T;

            if (t == null)
            {
                string message = string.Format("Routing key type {0} is not supported", routingKey.GetType());
                throw new ArgumentException(message, "routingKey");
            }
            return(this.GetMailboxRoutingEntry(t, diagnostics));
        }
Exemplo n.º 2
0
        IRoutingEntry IRoutingLookup.GetRoutingEntry(IRoutingKey routingKey, IRoutingDiagnostics diagnostics)
        {
            if (routingKey == null)
            {
                throw new ArgumentNullException("routingKey");
            }
            if (diagnostics == null)
            {
                throw new ArgumentNullException("diagnostics");
            }
            ServerRoutingKey serverRoutingKey = routingKey as ServerRoutingKey;

            if (serverRoutingKey == null)
            {
                string message = string.Format("Routing key type {0} is not supported", routingKey.GetType());
                throw new ArgumentException(message, "routingKey");
            }
            if (!string.IsNullOrEmpty(serverRoutingKey.Server))
            {
                int?version = null;
                if (serverRoutingKey.Version != null)
                {
                    version = serverRoutingKey.Version;
                }
                else
                {
                    version = this.versionLookup.LookupVersion(serverRoutingKey.Server);
                }
                return(new SuccessfulServerRoutingEntry(serverRoutingKey, new ServerRoutingDestination(serverRoutingKey.Server, version), DateTime.UtcNow.ToFileTimeUtc()));
            }
            ErrorRoutingDestination destination = new ErrorRoutingDestination("Could not extract server from ServerRoutingKey");

            return(new FailedServerRoutingEntry(serverRoutingKey, destination, DateTime.UtcNow.ToFileTimeUtc()));
        }