Exemple #1
0
        static void Main(string[] args)
        {
            // The Orleans silo environment is initialized in its own app domain in order to more
            // closely emulate the distributed situation, when the client and the server cannot
            // pass data via shared memory.
            AppDomain hostDomain = AppDomain.CreateDomain("OrleansHost", null, new AppDomainSetup
            {
                AppDomainInitializer          = InitSilo,
                AppDomainInitializerArguments = args,
            });

            Orleans.OrleansClient.Initialize("DevTestClientConfiguration.xml");

            // Observer

            IDoStuff grain = DoStuffFactory.GetGrain(0);

            var theObserver = new TheObserver();
            var obj         = ObserveFactory.CreateObjectReference(theObserver).Result; // factory from IObserve

            grain.SubscribeForUpdates(obj);


            // close down

            Console.WriteLine("Orleans Silo is running.\nPress Enter to terminate...");
            Console.ReadLine();

            hostDomain.DoCallBack(ShutdownSilo);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            // The Orleans silo environment is initialized in its own app domain in order to more
            // closely emulate the distributed situation, when the client and the server cannot
            // pass data via shared memory.
            AppDomain hostDomain = AppDomain.CreateDomain("OrleansHost", null, new AppDomainSetup
            {
                AppDomainInitializer = InitSilo,
                AppDomainInitializerArguments = args,
            });

            Orleans.OrleansClient.Initialize("DevTestClientConfiguration.xml");

            // Observer

            IDoStuff grain = DoStuffFactory.GetGrain(0);

            var theObserver = new TheObserver();
            var obj = ObserveFactory.CreateObjectReference(theObserver).Result; // factory from IObserve

            grain.SubscribeForUpdates(obj);
            

            // close down

            Console.WriteLine("Orleans Silo is running.\nPress Enter to terminate...");
            Console.ReadLine();

            hostDomain.DoCallBack(ShutdownSilo);
        }
Exemple #3
0
        private static async Task DoClientWork()
        {
            IObserverGrain observerGrain = GrainClient.GrainFactory.GetGrain <IObserverGrain>(0);
            await observerGrain.Start();

            var theObserver = new TheObserver();
            var obj         = GrainClient.GrainFactory.CreateObjectReference <IObserve>(theObserver).Result; // factory from IObserve

            ISourceGrain sourceGrain = GrainClient.GrainFactory.GetGrain <ISourceGrain>(0);
            await sourceGrain.SubscribeForUpdates(obj);

            //await sourceGrain.SubscribeForUpdates(observerGrain);

            Console.WriteLine("Client is running.\nPress Enter to terminate...");
            Console.ReadLine();
        }