示例#1
0
 public static IOutkeepServerBuilder AddCoreServices(this IOutkeepServerBuilder builder)
 {
     return(builder
            .ConfigureSilo(silo =>
     {
         silo.AddOutkeep();
     }));
 }
        public static IOutkeepServerBuilder ConfigureSilo(this IOutkeepServerBuilder builder, Action <ISiloBuilder> configure)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            return(builder.ConfigureSilo((context, silo) => configure(silo)));
        }
示例#3
0
        public static IOutkeepServerBuilder UseStandaloneClustering(
            this IOutkeepServerBuilder outkeep,
            int siloPort     = 11111,
            int gatewayPort  = 30000,
            string serviceId = "dev",
            string clusterId = "dev",
            bool searchPorts = false)
        {
            if (outkeep == null)
            {
                throw new ArgumentNullException(nameof(outkeep));
            }

            outkeep.ConfigureSilo((context, silo) =>
            {
                var actualSiloPort    = searchPorts ? TcpHelper.Default.GetFreePort(siloPort) : siloPort;
                var actualGatewayPort = searchPorts ? TcpHelper.Default.GetFreePort(gatewayPort) : gatewayPort;

                silo.UseLocalhostClustering(actualSiloPort, actualGatewayPort, new IPEndPoint(IPAddress.Loopback, siloPort), serviceId, clusterId);
            });

            return(outkeep);
        }