Exemplo n.º 1
0
        private static void RunCommand(string command, string[] args)
        {
            var clientBuilder = new ClientBuilder().LoadConfiguration();

            using (client = (IInternalClusterClient)clientBuilder.Build())
            {
                client.Connect().Wait();
                systemManagement = client.GetGrain <IManagementGrain>(0);
                var options = args.Skip(1)
                              .Where(s => s.StartsWith("-"))
                              .Select(s => s.Substring(1).Split('='))
                              .ToDictionary(a => a[0].ToLowerInvariant(), a => a.Length > 1 ? a[1] : "");

                var restWithoutOptions = args.Skip(1).Where(s => !s.StartsWith("-")).ToArray();

                switch (command)
                {
                case "grainstats":
                    PrintSimpleGrainStatistics(restWithoutOptions);
                    break;

                case "fullgrainstats":
                    PrintGrainStatistics(restWithoutOptions);
                    break;

                case "collect":
                    CollectActivations(options, restWithoutOptions);
                    break;

                case "unregister":
                    var unregisterArgs = args.Skip(1).ToArray();
                    UnregisterGrain(unregisterArgs);
                    break;

                case "lookup":
                    var lookupArgs = args.Skip(1).ToArray();
                    LookupGrain(lookupArgs);
                    break;

                case "grainreport":
                    var grainReportArgs = args.Skip(1).ToArray();
                    GrainReport(grainReportArgs);
                    break;

                default:
                    PrintUsage();
                    break;
                }

                client.Close().Wait();
            }
        }
Exemplo n.º 2
0
        protected virtual IClusterClient InitGrainClient()
        {
            if (_clusterClient == null)
            {
                lock (_locker)
                {
                    if (_clusterClient != null)
                    {
                        return(_clusterClient);
                    }

                    var gateways = new[]
                    {
                        new IPEndPoint(IPAddress.Loopback, BasePort + (int)PortOffsets.SiloGateway),
                    };

                    var grainClientBuilder = new ClientBuilder();

                    grainClientBuilder.UseStaticClustering(gateways);

                    grainClientBuilder
                    .Configure <ClusterOptions>(options =>
                    {
                        options.ClusterId = "dev";
                        options.ServiceId = "dev";
                    })
                    .Configure <SerializationProviderOptions>(options =>
                    {
                        options.SerializationProviders.Add(typeof(OrleansCustomSerialization));

                        if (_customSerializer != null)
                        {
                            // IF the custom serializer inherits the default one,
                            // replace it (as base class will supports all registered serialization types)
                            if (_customSerializer.IsSubclassOf(typeof(OrleansCustomSerialization)))
                            {
                                options.SerializationProviders.Remove(typeof(OrleansCustomSerialization));
                            }
                            options.SerializationProviders.Add(_customSerializer);
                        }
                    });

                    var grainClient = grainClientBuilder.Build();

                    grainClient.Connect().GetAwaiter().GetResult();

                    _clusterClient = grainClient;
                }
            }

            return(_clusterClient);
        }
Exemplo n.º 3
0
        public void ClientBuilder_DoubleSpecifyConfigurationTest()
        {
            var builder = new ClientBuilder()
                          .ConfigureDefaults()
                          .ConfigureApplicationParts(
                parts => parts
                .AddFromApplicationBaseDirectory()
                .AddFromAppDomain()).ConfigureServices(RemoveConfigValidators)
                          .UseConfiguration(new ClientConfiguration())
                          .UseConfiguration(new ClientConfiguration());

            Assert.Throws <InvalidOperationException>(() => builder.Build());
        }
Exemplo n.º 4
0
        public void ClientBuilder_AssembliesTest()
        {
            var builder = (IClientBuilder) new ClientBuilder();

            Assert.Throws <OrleansConfigurationException>(() => builder.Build());

            // Adding an application assembly allows the builder to build successfully.
            builder = new ClientBuilder().ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(IAccountGrain).Assembly));
            using (var client = builder.Build())
            {
                Assert.NotNull(client);
            }
        }
Exemplo n.º 5
0
        public GraphManager(string connectionString, LoggerType loggers, LogLevel logLevel, string instrumentationKey = null)
        {
            //use storage provider
            var builder = new ClientBuilder();

            builder.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(IPiSystem).Assembly));

            AddStorageProvider(builder, connectionString);
            AddAppInsighlts(builder, loggers, instrumentationKey);
            AddLoggers(builder, loggers, logLevel, instrumentationKey);
            this.client = builder.Build();
            this.client.Connect(CreateRetryFilter()).GetAwaiter().GetResult();
        }
Exemplo n.º 6
0
        private static IClusterClient BuildOrleansClient()
        {
            var clientBuilder = new ClientBuilder()
                                .UseLocalhostClustering()
                                .Configure <ClusterOptions>(options =>
            {
                options.ClusterId = "Demo.IoT.Cluster";
                options.ServiceId = "IoT.Client";
            })
                                .ConfigureLogging(logging => logging.AddConsole());

            return(clientBuilder.Build());
        }
    public async void List_releases_that_needs_updates()
    {
        var gitHubClient = ClientBuilder.Build();

        var releaseNotesBuilder = new ReleaseManager(gitHubClient, "Particular");
        var result = await releaseNotesBuilder.GetReleasesInNeedOfUpdates();

        Debug.WriteLine("{0} releases found that needs updating", result.Count());
        foreach (var releaseName in result)
        {
            Debug.WriteLine(releaseName);
        }
    }
Exemplo n.º 8
0
        public void ClientBuilder_ThrowsDuringStartupIfNoGrainInterfacesAdded()
        {
            // Add only an assembly with generated serializers but no grain interfaces
            var clientBuilder = new ClientBuilder()
                                .UseLocalhostClustering()
                                .Configure <GrainTypeOptions>(options =>
            {
                options.Interfaces.Clear();
            })
                                .ConfigureServices(services => services.AddSingleton <IGatewayListProvider, NoOpGatewaylistProvider>());

            Assert.Throws <OrleansConfigurationException>(() => clientBuilder.Build());
        }
Exemplo n.º 9
0
            public ClientWrapperBase(string name, int gatewayport, string clusterId, Action <IClientBuilder> clientConfigurator)
            {
                this.Name = name;
                Console.WriteLine($"Initializing client {name}");
                var internalClientBuilder = new ClientBuilder()
                                            .UseLocalhostClustering(gatewayport, clusterId, clusterId);

                clientConfigurator?.Invoke(internalClientBuilder);
                this.InternalClient = (IInternalClusterClient)internalClientBuilder.Build();
                this.InternalClient.Connect().Wait();
                var loggerFactory = this.InternalClient.ServiceProvider.GetRequiredService <ILoggerFactory>();

                this.Logger = loggerFactory.CreateLogger($"Client-{name}");
            }
Exemplo n.º 10
0
        public void BuildingShouldReturn()
        {
            // arrange
            var builder = new ClientBuilder(new Uri("http://example.com", UriKind.Absolute), "foo", "bar");

            // act
            var result = builder.Build();

            // assert
            Assert.NotNull(result);
            Assert.Equal("KellyStuard NoIp Docker/1.0 foo", result.DefaultRequestHeaders.UserAgent.ToString());
            Assert.Equal("Basic", result.DefaultRequestHeaders.Authorization.Scheme);
            Assert.Equal(Convert.ToBase64String(Encoding.ASCII.GetBytes("foo:bar")), result.DefaultRequestHeaders.Authorization.Parameter);
        }
Exemplo n.º 11
0
        public SerializationTestEnvironment(ClientConfiguration config = null, Action <IClientBuilder> configureClientBuilder = null)
        {
            if (config == null)
            {
                config = this.DefaultConfig();
            }

            var builder = new ClientBuilder().ConfigureDefaults();

            builder.UseConfiguration(config);
            configureClientBuilder?.Invoke(builder);
            this.Client        = builder.Build();
            this.RuntimeClient = this.Client.ServiceProvider.GetRequiredService <OutsideRuntimeClient>();
        }
Exemplo n.º 12
0
        public ActorClientService(IConfiguration config, ILogger <ActorClientService> log)
        {
            _config = config;
            _log    = log;

            var builder =
                new ClientBuilder()
                .Configure <ClusterOptions>(options =>
            {
                options.ClusterId = "serverlessorleans";
                options.ServiceId = "serverlessorleans";
            })
                .ConfigureLogging(builder => builder.AddConsole())
                .ConfigureApplicationParts(parts =>
            {
                foreach (var assembly in ExternalAssemblies)
                {
                    System.Console.WriteLine("Loading orleans app parts: " + assembly.FullName);
                    parts.AddApplicationPart(assembly);
                }
            })
                .UseDashboard();

            var env = _config["ORLEANS_CONFIG"];

            if (env == "SQL")
            {
                builder =
                    builder.UseAdoNetClustering(options =>
                {
                    options.Invariant        = "System.Data.SqlClient";
                    options.ConnectionString = Environment.GetEnvironmentVariable("SqlConnectionString");
                });
            }
            else if (env == "STORAGE")
            {
                builder =
                    builder.UseAzureStorageClustering(options =>
                {
                    options.TableName        = "clusterstate";
                    options.ConnectionString = Environment.GetEnvironmentVariable("AzureWebJobsStorage");
                });
            }
            else
            {
                throw new Exception("ORLEANS_CONFIG envvar not defined.");
            }

            Client = builder.Build();
        }
Exemplo n.º 13
0
        protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners()
        {
            return(new ServiceInstanceListener[]
            {
                new ServiceInstanceListener(serviceContext =>

                                            new KestrelCommunicationListener(serviceContext, "ServiceEndpoint", (url, listener) =>
                {
                    ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting Kestrel on {url}");

                    var serviceName = new Uri("fabric:/RWProtoTwo/RiftRunServerService");

                    var builder = new ClientBuilder();

                    builder.Configure <ClusterOptions>(options =>
                    {
                        options.ServiceId = serviceName.ToString();
                        options.ClusterId = "RitRunProto";
                    });

                    builder.UseAzureStorageClustering(options => options.ConnectionString = ConnectionString);

                    builder.ConfigureApplicationParts(parts =>
                    {
                        parts.AddFromApplicationBaseDirectory();
                    });

                    var client = builder.Build();

                    ConnectToServer(client);

                    var accountManager = client.GetGrain <IAccountOrchestrator>("AccountOrchestrator");   //activate Orchestrator

                    accountManager.CreateAccountOrchestrator();

                    return new WebHostBuilder()
                    .UseKestrel()
                    .ConfigureServices(services =>
                    {
                        services.AddSingleton <StatelessServiceContext>(serviceContext);
                        services.AddSingleton <IClusterClient>(client);
                    })
                    .UseContentRoot(Directory.GetCurrentDirectory())
                    .UseStartup <Startup>()
                    .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None)
                    .UseUrls(url)
                    .Build();
                }))
            });
        }
        public static IClusterClient GetInstance(TraceWriter log = null)
        {
            if (_instance == null)
            {
                log?.Info(@"Creating connection to Orleans silo...");
                Trace.WriteLine(@"t: Creating connection to Orleans silo...");
                //// Parse the IP Address out of app settings
                //var siloIpAddressString = Environment.GetEnvironmentVariable(@"SiloEndpointIP");
                //var siloIpAddressBytes = siloIpAddressString.Split('.').Select(i => byte.Parse(i)).ToArray();

                //// parse the port to uint to ensure the value is >=0
                //var siloPort = uint.Parse(Environment.GetEnvironmentVariable(@"SiloEndpointPort"));
                //log?.Info($@" @ {siloIpAddressString}:{siloPort}");
                //Trace.WriteLine($@"t:  @ {siloIpAddressString}:{siloPort}");

                var builder = new ClientBuilder()
                              .Configure <ClusterOptions>(options =>
                {
                    options.ClusterId = @"ForFunctions";
                    options.ServiceId = @"AzureFunctionsSample";
                })
                              .UseAzureStorageClustering(opt => opt.ConnectionString = Environment.GetEnvironmentVariable(@"ClusterStorageConnectionString"));

                _instance = builder.Build();
                log?.Info(@"Client successfully built with Azure Storage clustering...");
                Trace.WriteLine(@"t: Client successfully built with Azure Storage clustering...");

                const int maxRetries = 5;
                int       retryCount = 0;
                _instance.Connect(async ex =>
                {
                    log.Info(ex.Message);

                    if (++retryCount < maxRetries)
                    {
                        await Task.Delay(TimeSpan.FromSeconds(3));
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }).Wait();

                log?.Info(@"Connected.");
                Trace.WriteLine(@"t: Connected.");
            }

            return(_instance);
        }
Exemplo n.º 15
0
        public void ClientBuilder_ServiceProviderTest()
        {
            var builder = new ClientBuilder()
                          .ConfigureDefaults()
                          .ConfigureServices(RemoveConfigValidators)
                          .ConfigureServices(services => services.AddSingleton <IGatewayListProvider, NoOpGatewaylistProvider>());

            Assert.Throws <ArgumentNullException>(() => builder.ConfigureServices(null));

            var registeredFirst = new int[1];

            var one = new MyService {
                Id = 1
            };

            builder.ConfigureServices(
                services =>
            {
                Interlocked.CompareExchange(ref registeredFirst[0], 1, 0);
                services.AddSingleton(one);
            });

            var two = new MyService {
                Id = 2
            };

            builder.ConfigureServices(
                services =>
            {
                Interlocked.CompareExchange(ref registeredFirst[0], 2, 0);
                services.AddSingleton(two);
            });

            using (var client = builder.Build())
            {
                var services = client.ServiceProvider.GetServices <MyService>()?.ToList();
                Assert.NotNull(services);

                // Both services should be registered.
                Assert.Equal(2, services.Count);
                Assert.NotNull(services.FirstOrDefault(svc => svc.Id == 1));
                Assert.NotNull(services.FirstOrDefault(svc => svc.Id == 2));

                // Service 1 should have been registered first - the pipeline order should be preserved.
                Assert.Equal(1, registeredFirst[0]);

                // The last registered service should be provided by default.
                Assert.Equal(2, client.ServiceProvider.GetRequiredService <MyService>().Id);
            }
        }
Exemplo n.º 16
0
        private static void Main(string[] args)
        {
            Task.Run(async() =>
            {
                var cancelSource = new CancellationTokenSource();
                var layout       = new ConsoleLayout
                {
                    Title           = $"Orikivo: {OriGlobal.ClientVersion}",
                    BackgroundColor = ConsoleColor.DarkCyan,
                    ForegroundColor = ConsoleColor.Cyan,
                    CursorVisible   = false
                };

                layout.Set();

                var builder = new ClientBuilder();
                builder.SetDefaultServices();

                builder.Services
                .AddSingleton <InfoService>();

                builder
                .AddEnumTypeReader <ReportTag>()
                .AddEnumTypeReader <EventType>()
                .AddEnumTypeReader <RasterizerType>()
                .AddEnumTypeReader <MeritGroup>()
                .AddEnumTypeReader <Gamma>()
                .AddEnumTypeReader <FontType>()
                .AddEnumTypeReader <PaletteType>()
                .AddEnumTypeReader <BorderAllow>()
                .AddEnumTypeReader <Casing>()
                .AddEnumTypeReader <ImageScale>()
                .AddEnumTypeReader <CardDeny>();

                builder
                .AddModule <CoreModule>()
                .AddModule <MessyModule>()
                .AddModule <DigitalModule>()
                .AddModule <GraphicsModule>()
                .AddModule <Actions>();

                Client client = builder.Build()
                                .WithStatus(UserStatus.DoNotDisturb)
                                .WithActivity("Minecraft", type: ActivityType.Listening);

                client.EnsureDefaultServices();
                await client.StartAsync(cancelSource.Token);
            }).GetAwaiter().GetResult();
        }
Exemplo n.º 17
0
        private IClusterClient CreateOrleansClient()
        {
            var clientBuilder = new ClientBuilder()
                                .UseLocalhostClustering()
                                .Configure <ClientMessagingOptions>(options =>
            {
                // Needed by Reactive pool: reduced message timeout to ease promise break testing
                options.ResponseTimeout             = TimeSpan.FromSeconds(30 * 60); // was 10
                options.ResponseTimeoutWithDebugger = TimeSpan.FromSeconds(30 * 60); // was 10
            })
                                .Configure <SerializationProviderOptions>(_ =>
            {
                _.SerializationProviders.Add(typeof(Orleans.Serialization.ProtobufNet.ProtobufNetSerializer).GetTypeInfo());
                RuntimeTypeModel.Default.Add(typeof(DateTimeOffset), false).SetSurrogate(typeof(DateTimeOffsetSurrogate));
            })
                                .Configure <ClusterOptions>(options =>
            {
                options.ClusterId = "dev";
                options.ServiceId = "TestInventoryService";
            })
                                .Configure <ProcessExitHandlingOptions>(options => options.FastKillOnProcessExit = false)
                                .ConfigureLogging(logging => logging.AddConsole())

                                // .AddSimpleMessageStreamProvider("SMSProvider");
                                .AddAzureQueueStreams <AzureQueueDataAdapterV2>("AzureQueueProvider", optionsBuilder => optionsBuilder.Configure(options => { options.ConnectionString = "UseDevelopmentStorage=true"; }))
                                // .AddAzureTableGrainStorage("PubSubStore", options => { options.ConnectionString = "UseDevelopmentStorage=true"; });
            ;

            var client = clientBuilder.Build();

            client.Connect(async ex =>
            {  // replace Console with actual logging
                Console.WriteLine(ex);
                Console.WriteLine("Retrying...");
                await Task.Delay(3000);
                return(true);
            }).Wait();

            // startup the global reminders
            {
                var g = client.GetGrain <IInventoryAutoSupplying>(Guid.Empty);
                g.Start();
            }
            {
                var g = client.GetGrain <IOrderScheduledProcessing>(Guid.Empty);
                g.Start();
            }
            return(client);
        }
Exemplo n.º 18
0
        public void ClientBuilder_NoSpecifiedConfigurationTest()
        {
            var builder = new ClientBuilder()
                          .ConfigureDefaults()
                          .ConfigureApplicationParts(
                parts => parts
                .AddFromApplicationBaseDirectory()
                .AddFromAppDomain()).ConfigureServices(RemoveConfigValidators)
                          .ConfigureServices(services => services.AddSingleton <IGatewayListProvider, NoOpGatewaylistProvider>());

            using (var client = builder.Build())
            {
                Assert.NotNull(client);
            }
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            var clientBuilder = new ClientBuilder();

            clientBuilder.UseLocalhostClustering();
            var client = clientBuilder.Build();

            Console.WriteLine("start to connect");
            client.Connect(exception => Task.FromResult(true)).Wait();
            Console.WriteLine("connected");

            services.AddSingleton <IGrainFactory>(client);
        }
Exemplo n.º 20
0
        public void ClientBuilder_AssembliesTest()
        {
            var builder = new ClientBuilder()
                          .ConfigureServices(services => services.AddSingleton <IGatewayListProvider, NoOpGatewaylistProvider>());

            Assert.Throws <OrleansConfigurationException>(() => builder.Build());

            // Adding an application assembly allows the builder to build successfully.
            builder = new ClientBuilder().ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(IAccountGrain).Assembly))
                      .ConfigureServices(services => services.AddSingleton <IGatewayListProvider, NoOpGatewaylistProvider>());
            using (var client = builder.Build())
            {
                Assert.NotNull(client);
            }
        }
Exemplo n.º 21
0
        public void ClientBuilder_NoClusterIdTest()
        {
            Assert.Throws <OrleansConfigurationException>(() => new ClientBuilder()
                                                          .ConfigureServices(services => services.AddSingleton <IGatewayListProvider, NoOpGatewaylistProvider>())
                                                          .Build());

            var builder = new ClientBuilder()
                          .Configure <ClusterOptions>(options => options.ClusterId = "test")
                          .ConfigureServices(services => services.AddSingleton <IGatewayListProvider, NoOpGatewaylistProvider>());

            using (var client = builder.Build())
            {
                Assert.NotNull(client);
            }
        }
Exemplo n.º 22
0
        partial void Start(NSButton sender)
        {
            var target   = TargetField.StringValue;
            var host     = HostField.StringValue;
            var port     = PortField.IntValue;
            var userid   = UseridField.IntValue;
            var password = PasswordField.StringValue;

            var builder = new ClientBuilder()
                          .UseGrpc(target, host, port)
                          .SetUser(userid, password);

            client = builder.Build();
            client.Login();
        }
Exemplo n.º 23
0
        private IClusterClient OrleansClient()
        {
            var clientBuilder = new ClientBuilder()
                                .UseLocalhostClustering()
                                .Configure <ClusterOptions>(options =>
            {
                options.ClusterId = "cluster1";
                options.ServiceId = "clusterService1";
            })
                                .ConfigureLogging(logging => logging.AddConsole());
            var client = clientBuilder.Build();

            client.Connect().Wait();
            return(client);
        }
        public TestClusterFixture()
        {
            var options = new TestClusterOptions(2);

            options.ClusterConfiguration.UseStartupType <Startup>();

            _cluster = new TestCluster(options);
            _cluster.Deploy();

            var builder = new ClientBuilder()
                          .UseConfiguration(options.ClientConfiguration)
                          .UseDiagnostics();

            Client = builder.Build();
            Client.Connect().Wait();
        }
Exemplo n.º 25
0
        private IClusterClient CreateOrleansClient()
        {
            var clientBuilder = new ClientBuilder()
                                .UseLocalhostClustering() //Connects to tcp port 30000 by default
                                .Configure <ClusterOptions>(options =>
            {
                options.ClusterId = "dev";
                options.ServiceId = "ConsoleClient";
            })
                                .ConfigureApplicationParts(parts => parts.AddFromApplicationBaseDirectory());

            var client = clientBuilder.Build();

            client.Connect().Wait();
            return(client);
        }
Exemplo n.º 26
0
        public static void AddSingletonOrleansClusterClient(this IServiceCollection services, OrleansConfig config)
        {
            services.AddSingleton(serviceProvider =>
            {
                var builder = new ClientBuilder();
                if (!string.IsNullOrEmpty(config.InstrumentationKey))
                {
                    builder.AddApplicationInsightsTelemetryConsumer(config.InstrumentationKey);
                }

                builder.AddOrleansClusterClient(config);
                IClusterClient client = builder.Build();
                client.Connect(CreateRetryFilter()).GetAwaiter().GetResult();
                return(client);
            });
        }
Exemplo n.º 27
0
        private static async Task <IClusterClient> ConnectClientAsync()
        {
            var builder = new ClientBuilder()
                          .UseLocalhostClustering()
                          .Configure <ClusterOptions>(options =>
            {
                options.ClusterId = "dev";
                options.ServiceId = "LearnOrleans";
            })
                          .ConfigureLogging(logging => logging.AddConsole());

            var client = builder.Build();
            await client.Connect();

            return(client);
        }
Exemplo n.º 28
0
        static async Task ConnectAsync()
        {
            try
            {
                var config  = ClientConfiguration.LocalhostSilo();
                var builder = new ClientBuilder().UseConfiguration(config);
                var client  = builder.Build();
                await client.Connect();

                Console.WriteLine("客户端连接成功");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 29
0
        private IClusterClient CreateOrleansClient()
        {
            var clientBuilder = new ClientBuilder()
                                .UseLocalhostClustering()
                                .Configure <ClusterOptions>(options =>
            {
                options.ClusterId = "dev";
                options.ServiceId = "ProductAPI";
            });

            var client = clientBuilder.Build();

            client.Connect().Wait();

            return(client);
        }
Exemplo n.º 30
0
        private static async Task <IClusterClient> StartClientWithRetries(int initializeAttemptsBeforeFailing = 5)
        {
            int            attempt = 0;
            IClusterClient client;

            while (true)
            {
                try
                {
                    var builder = new ClientBuilder()
                                  .Configure <ClusterOptions>(options =>
                    {
                        options.ClusterId = "dev";
                        options.ServiceId = "Transfer";
                    })
                                  //.UseLocalhostClustering()
                                  .UseAdoNetClustering(delegate(AdoNetClusteringClientOptions options)
                    {
                        options.Invariant        = "Npgsql";
                        options.ConnectionString =
                            "Server=localhost;Port=5432;Database=Vertex;User Id=postgres;Password=postgres;Pooling=true;MaxPoolSize=20;";
                    })
                                  .ConfigureApplicationParts(parts =>
                                                             parts.AddApplicationPart(typeof(IAccount).Assembly).WithReferences())
                                  .ConfigureLogging(logging => logging.AddConsole());
                    client = builder.Build();
                    await client.Connect();

                    Console.WriteLine("Client successfully connect to silo host");
                    break;
                }
                catch (Exception ex)
                {
                    attempt++;
                    Console.WriteLine(
                        $"Attempt {attempt} of {initializeAttemptsBeforeFailing} failed to initialize the Orleans client.");
                    if (attempt > initializeAttemptsBeforeFailing)
                    {
                        throw;
                    }

                    await Task.Delay(TimeSpan.FromSeconds(5));
                }
            }

            return(client);
        }