Exemple #1
0
        public static Tuple <JRpcService, T> StartService <T>(string serviceName, JRpcModule jRpcModule, string ipAdress = null, string port = null) where T : class
        {
            if (string.IsNullOrEmpty(ipAdress))
            {
                ipAdress = DEFAULT_IP_ADRESS;
            }
            if (string.IsNullOrEmpty(port))
            {
                port = DEFAULT_PORT;
            }

            ConfigurationManager.AppSettings.Set("ServiceAddress", ipAdress);
            ConfigurationManager.AppSettings.Set("ServicePort", port);
            var consulClient = new ConsulClient();
            var registry     = new DefaultModulesRegistry();

            registry.AddJRpcModule(jRpcModule);
            var service = new JRpcService(registry, consulClient);

            service.Start();
            var path        = $"http://{ipAdress}:{port}";
            var client      = new JRpcClient(path);
            var clientProxy = client.GetProxy <T>(serviceName);

            return(Tuple.Create(service, clientProxy));
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            var client = new JRpcClient();


            var proxy = client.GetProxy <INewTestService>("NewTestService");


            proxy.Test(100, 50);

            Console.ReadLine();

//
//            HostFactory.Run(c => {
//                c.UseNinject(new StatisticCommonServiceNinjectModule())
//                    .Service<JRpcService>(s => {
//                        s.ConstructUsingNinject();
//                        s.WhenStarted((service, control) => service.Start());
//                        s.WhenStopped((service, control) => service.Stop());
//                    });
//                c.RunAsNetworkService();
//                c.SetServiceName("StatisticCommonService");
//                c.SetDisplayName("StatisticCommonService");
//                c.SetDescription("StatisticCommonService for Ingate");
//            });
//            Console.ReadLine();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            PagesSaveHelper pagesSaveHelper = new PagesSaveHelper();

            string[] domainNames =
            {
                "http://xn----8sbijoijw0aeo.xn--p1ai/",
                "http://uk4gorodtula.ru/",
                "http://rem-super.ru/"
            };
            string saveDataPath = "Saved pages";

            var client = new JRpcClient("http://127.0.0.1:12345");
            var proxy  = client.GetProxy <ISimpleService>("SimpleService");

            Console.WriteLine("Start parsing sites...");
            ReadOnlyCollection <Uri>[] sites = proxy.GetWebsitesLinks(domainNames).Result;
            Console.WriteLine();
            Console.WriteLine("End parsing sites.");
            Console.WriteLine("Start downloading pages...");
            pagesSaveHelper.Save(sites, saveDataPath);
            Console.ReadLine();
        }
Exemple #4
0
        static void Main(string[] args)
        {
            var parser = new JRpcClient("http://169.254.99.73:32435/").GetProxy <IParserService>("ParserService");

            ProcessDomains.Process(parser);
        }