コード例 #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");

            // TODO: once the previous call returns, the silo is up and running.
            //       This is the place your custom logic, for example calling client logic
            //       or initializing an HTTP front end for accepting incoming requests.

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

            var observer    = new SystemObserver();
            var observerRef = SystemObserverFactory.CreateObjectReference(observer).Result;

            var systemGrain = SystemGrainFactory.GetGrain(0, "vehicle1");

            systemGrain.Subscribe(observerRef).Wait();

            var grain = DecodeGrainFactory.GetGrain(0);

            while (true)
            {
                grain.Decode(Console.ReadLine());
            }

            hostDomain.DoCallBack(ShutdownSilo);
        }
コード例 #2
0
        public Task Post([FromBody] string message)
        {
            var grain = DecodeGrainFactory.GetGrain(0);

            return(grain.Decode(message));
        }