Exemple #1
0
        static void Main()
        {
            // Start up the Cloud Gateway!
            using (var cloud = new CloudServiceClient())
            {
                // Formulate our Request
                var request = new Request
                {
                    Argument = 15,
                    Services = new[]
                    {
                        new ServiceCall
                        {
                            Name = "Decrementer",
                            Services = new[]
                            {
                                new ServiceCall { Name = "Incrementer" },
                                new ServiceCall { Name = "Incrementer" },
                                new ServiceCall { Name = "Incrementer" },
                                new ServiceCall { Name = "Incrementer" },
                                new ServiceCall { Name = "Incrementer" },
                                new ServiceCall { Name = "Incrementer" },
                                new ServiceCall { Name = "Incrementer" },
                            },
                        },
                        new ServiceCall { Name = "Decrementer" },
                        new ServiceCall { Name = "Decrementer" },
                        new ServiceCall { Name = "Decrementer" },
                    },
                };

                // Assign the Endpoint Addresses (avoids redundancy -- this could easily be its own Service)
                request.Services.ToList().ForEach(AssignAddress);

                // Get a Response from the Gateway
                var response = cloud.Execute(request);

                if (response == null)
                {
                    Console.WriteLine("Response is NULL!!!");
                    Console.ReadLine();
                    return;
                }

                Console.WriteLine("ReturnObject is {0}", response.ReturnObject);

                // Find out which services ran
                if (response.ServicesRan != null && response.ServicesRan.Length > 0)
                {
                    response.ServicesRan.ToList().ForEach(s => Console.WriteLine("Ran on Service: {0}", s));
                }

                cloud.Close();
            }

            Console.ReadLine();
        }