Ejemplo n.º 1
0
        private static async Task <IClusterClient> TryConnect(IConfiguration config)
        {
            IClusterClient client = null;

            try
            {
                var builder = new ClientBuilder();

                //builder.ConfigureLogging(logging => {
                //    logging
                //    .AddFilter("Microsoft", LogLevel.Warning)
                //    .AddFilter("Orleans", LogLevel.Warning)
                //    .AddFilter("Runtime", LogLevel.Warning)
                //    .AddConsole();
                //})

                // TODO read configuration
                builder.UseLocalhostClustering(); // cluster and service IDs default to "dev"

                builder.AddJobFacServicesParts();
                client = builder.Build();

                // causes host builder to run hosted services???
                await client.Connect().ConfigureAwait(false);
            }
            catch
            {
                client?.Dispose();
                throw;
            }

            return(client);
        }