Пример #1
0
        protected int GetBasePortFromHttpServiceAttribute()
        {
            var commonConfig = new BaseCommonConfig();
            var mapper       = new OrleansServiceInterfaceMapper(new AssemblyProvider(new ApplicationDirectoryProvider(commonConfig), commonConfig, new ConsoleLog()));
            var basePort     = mapper.ServiceInterfaceTypes.First().GetCustomAttribute <HttpServiceAttribute>().BasePort;

            return(basePort);
        }
Пример #2
0
        protected virtual ServiceArguments GetServiceArguments(int?basePortOverride, bool isSecondary, int?shutdownWaitTime, ServiceStartupMode startupMode = ServiceStartupMode.CommandLineNonInteractive)
        {
            if (isSecondary && basePortOverride == null)
            {
                throw new ArgumentException("You must specify a basePortOverride when running a secondary silo.");
            }

            var siloClusterMode        = isSecondary ? SiloClusterMode.SecondaryNode : SiloClusterMode.PrimaryNode;
            ServiceArguments arguments = new ServiceArguments(startupMode, basePortOverride: basePortOverride, siloClusterMode: siloClusterMode, shutdownWaitTimeSec: shutdownWaitTime);

            if (basePortOverride != null)
            {
                return(arguments);
            }

            var commonConfig = new BaseCommonConfig();
            var mapper       = new OrleansServiceInterfaceMapper(new AssemblyProvider(new ApplicationDirectoryProvider(commonConfig), commonConfig, Log));
            var basePort     = mapper.ServiceInterfaceTypes.First().GetCustomAttribute <HttpServiceAttribute>().BasePort;

            return(new ServiceArguments(startupMode, basePortOverride: basePort, shutdownWaitTimeSec: shutdownWaitTime));
        }