Esempio n. 1
0
        public async Task InitAsync()
        {
            //configure the client with proper cluster options, logging and clustering
            ClientBuilder builder = new ClientBuilder();

            builder
            .UseLocalhostClustering()
            .Configure <ClusterOptions>(options =>
            {
                options.ClusterId = "dev";
                options.ServiceId = "HelloWorldApp";
            })
            .ConfigureLogging(logging => { /*logging.AddConsole();*/ });

            //  add message stream provider
            ClientStreamExtensions.AddSimpleMessageStreamProvider(builder, "TestStream");

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

            // subscribe stream
            Guid guid = Guid.NewGuid();

            // call grains from the initialized client
            var friend   = client.GetGrain <ITestStream>(0);
            var response = await friend.RegisterStream(guid);

            Console.WriteLine("\n\n{0}\n\n", response);

            var streamProvider = client.GetStreamProvider("TestStream");
            var stream         = streamProvider.GetStream <string>(guid, "Test");
            await stream.SubscribeAsync(testObserver);
        }
Esempio n. 2
0
 public void Plug(string proxyHost, int proxyPort)
 {
     ClientStreamExtensions.Plug(this, proxyHost, proxyPort);
 }
Esempio n. 3
0
 public void Plug(string host, int port)
 {
     ClientStreamExtensions.Plug(this, host, port);
 }