public static string[] GetServiceAddrs(EnvId env, SvcId svc, bool includeFallbackServers) { int port = SvcPort(env, svc); var settings = GetAppSettings(env, SvcPrefix(svc), false); string hostList = GetAppSettingsValueAsString(settings, "PrimaryServers"); if (includeFallbackServers) { hostList += ";" + GetAppSettingsValueAsString(settings, "FallbackServers"); } return(hostList.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Select(host => $"{host}:{port}").ToArray()); }
public static string SvcPrefix(SvcId svc) { switch (svc) { case SvcId.CoreServer: return("QDS_Core"); case SvcId.MarketData: return("QDS_MDAG"); case SvcId.GridSwitch: return("QDS_Grid"); case SvcId.CoreWProxy: return("QDS_Prxy"); default: throw new NotSupportedException("SvcId: " + svc); } }
private static int SvcPortOffset(SvcId svc) { switch (svc) { case SvcId.CoreServer: return(13); case SvcId.MarketData: return(18); case SvcId.GridSwitch: return(21); case SvcId.CoreWProxy: return(22); default: throw new NotSupportedException("SvcId: " + svc); } }
public WorkflowClient(IWorkContext context, NamedValueSet settings) { // default configuration const SvcId svc = SvcId.GridSwitch; EnvId env = EnvHelper.ParseEnvName(BuildConst.BuildEnv); Guid nodeId = Guid.NewGuid(); // custom configuration if (settings != null) { // environment env = (EnvId)settings.GetValue(WFPropName.EnvId, (int)env); } env = EnvHelper.CheckEnv(env); // derived configuration string hosts = null; int port = EnvHelper.SvcPort(env, svc); if (settings != null) { port = settings.GetValue(WFPropName.Port, port); hosts = settings.GetValue(WFPropName.Hosts, hosts); nodeId = settings.GetValue(WFPropName.NodeId, nodeId); } string svcName = EnvHelper.SvcPrefix(svc); string[] serviceAddrs = EnvHelper.GetServiceAddrs(env, svc, false); if (hosts != null) { serviceAddrs = hosts.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); } ServiceAddress resolvedServer = V111Helpers.ResolveServer(context.Logger, svcName, new ServiceAddresses(WcfConst.AllProtocols, serviceAddrs, port), new[] { typeof(IDiscoverV111).FullName }); // initialise worksteps List <IWorkstep> worksteps = GridWorksteps.Create(); foreach (IWorkstep workstep in worksteps) { workstep.Initialise(context); workstep.EnableGrid(GridLevel.Client, nodeId, resolvedServer.Port, resolvedServer.Host); } Clients = worksteps.ToArray(); }
public static int SvcPort(EnvId env, SvcId svc) { return(SvcPortBase(env) + SvcPortOffset(svc)); }