Example #1
0
        private async Task StreamingInitialize()
        {
            var implicitSubscriberTable = await transport.GetImplicitStreamSubscriberTable(this.InternalGrainFactory);

            clientProviderRuntime.StreamingInitialize(implicitSubscriberTable);
            var streamProviderManager = this.ServiceProvider.GetRequiredService <StreamProviderManager>();
            await streamProviderManager
            .LoadStreamProviders(
                this.config.ProviderConfigurations,
                clientProviderRuntime);

            CurrentStreamProviderManager = streamProviderManager;
        }
Example #2
0
        private void StreamingInitialize()
        {
            var implicitSubscriberTable = transport.GetImplicitStreamSubscriberTable(grainFactory).Result;

            clientProviderRuntime.StreamingInitialize(implicitSubscriberTable);
            var streamProviderManager = new Streams.StreamProviderManager();

            streamProviderManager
            .LoadStreamProviders(
                this.config.ProviderConfigurations,
                clientProviderRuntime)
            .Wait();
            CurrentStreamProviderManager = streamProviderManager;
        }
Example #3
0
        // used for testing to (carefully!) allow two clients in the same process
        private async Task StartInternal(Func <Exception, Task <bool> > retryFilter)
        {
            var gatewayManager = this.ServiceProvider.GetRequiredService <GatewayManager>();

            await ExecuteWithRetries(async() => await gatewayManager.StartAsync(CancellationToken.None), retryFilter);

            var generation = -SiloAddress.AllocateNewGeneration(); // Client generations are negative

            MessageCenter = ActivatorUtilities.CreateInstance <ClientMessageCenter>(this.ServiceProvider, localAddress, generation, clientId);
            MessageCenter.RegisterLocalMessageHandler(this.HandleMessage);
            MessageCenter.Start();
            CurrentActivationAddress = ActivationAddress.NewActivationAddress(MessageCenter.MyAddress, clientId.GrainId);

            this.gatewayObserver = new ClientGatewayObserver(gatewayManager);
            this.InternalGrainFactory.CreateObjectReference <IClientGatewayObserver>(this.gatewayObserver);

            await ExecuteWithRetries(
                async() => await this.ServiceProvider.GetRequiredService <ClientClusterManifestProvider>().StartAsync(),
                retryFilter);

            ClientStatistics.Start(MessageCenter, clientId.GrainId);

            clientProviderRuntime.StreamingInitialize();

            async Task ExecuteWithRetries(Func <Task> task, Func <Exception, Task <bool> > shouldRetry)
            {
                while (true)
                {
                    try
                    {
                        await task();

                        return;
                    }
                    catch (Exception exception) when(shouldRetry != null)
                    {
                        var retry = await shouldRetry(exception);

                        if (!retry)
                        {
                            throw;
                        }
                    }
                }
            }
        }
Example #4
0
        private async Task StreamingInitialize()
        {
            var implicitSubscriberTable = await transport.GetImplicitStreamSubscriberTable(this.InternalGrainFactory);

            clientProviderRuntime.StreamingInitialize(implicitSubscriberTable);
        }