Example #1
0
        static void Main(string[] args)
        {
            AutoInit.Init();
            AmqpAdaptor AmqpAdaptor = new AmqpAdaptor(ConfigManager.MQIP(), ConfigManager.AMQPPort(),
                ConfigManager.MQUser(), ConfigManager.MQPass());
            ServiceImplementStub.Bind<ICli2LoginImpl>(AmqpAdaptor, new LoginClientServiceImpl());
            ServiceImplementStub.Bind<ILoginNotifyImpl>(AmqpAdaptor, new LoginNotifyImpl());
            AmqpAdaptor.BeginReceive();

            RedisAdaptor = new RedisAdaptor(ConfigManager.CacheConn());
            CacheDataService = new RedisDataServiceDelegate(RedisAdaptor);

            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            AutoInit.Init();
            AmqpAdaptor AmqpAdaptor = new AmqpAdaptor(ConfigManager.MQIP(), ConfigManager.AMQPPort(),
                                                      ConfigManager.MQUser(), ConfigManager.MQPass());

            ServiceImplementStub.Bind <ICli2LoginImpl>(AmqpAdaptor, new LoginClientServiceImpl());
            ServiceImplementStub.Bind <ILoginNotifyImpl>(AmqpAdaptor, new LoginNotifyImpl());
            AmqpAdaptor.BeginReceive();

            RedisAdaptor     = new RedisAdaptor(ConfigManager.CacheConn());
            CacheDataService = new RedisDataServiceDelegate(RedisAdaptor);

            Console.ReadKey();
        }
Example #3
0
        static void InitService()
        {
            AutoInit.Init();
            TypeRegister.Init();

            RoutingRule.DistrictsName = ConfigManager.DistrictsName();

            zkAdaptor = new ZkAdaptor();
            //amqpAdaptor = new AmqpAdaptor(ConfigManager.MQIP(), ConfigManager.AMQPPort(),
            //    ConfigManager.MQUser(), ConfigManager.MQPass());

            //ServiceImplementStub.Bind<LogicClientServiceImpl, ILogicClientImpl>(amqpAdaptor, new LogicClientServiceImpl());
            ServiceImplementStub.Bind<IDbClientNotifyImpl>(zkAdaptor, new NotifyServiceImpl());

            //Logic2CliService = new ClientLogicServiceDelegate(amqpAdaptor);
            //loginNotifyDelegate = new LoginNotifyDelegate(amqpAdaptor);
            //SchedulerLogicService = new SchedulerLogicServiceDelegate(amqpAdaptor);

            dbClientNotifyDelegate = new DbClientNotifyDelegate(zkAdaptor);

            //ConfigManager.RegisterParser(new ConfigManager.ConfigParserDelegate<EndPoint>(s =>
            //{
            //    var rets = s.Split(':');
            //    var host = rets[0];
            //    var port = 0;

            //    int.TryParse(rets[1], out port);

            //    IPAddress ip;
            //    if (IPAddress.TryParse(host, out ip))
            //    {
            //        return new IPEndPoint(ip, port);
            //    }

            //    return new DnsEndPoint(host, port);
            //}));

            CacheService = new RedisDataServiceDelegate(new RedisAdaptor(ConfigManager.Instance.Read<List<EndPoint>>("DataService", "CacheConn")));
            //DbService = new MysqlDataServiceDelegate(new MysqlAdaptor(ConfigManager.DbIP(), ConfigManager.DbName(), ConfigManager.DbUser(), ConfigManager.DbPass()));

            zkAdaptor.BeginReceive();
            //amqpAdaptor.BeginReceive();

            zkAdaptor.Identity("Logic");

            //Heartbeat();
        }
Example #4
0
        static void InitService()
        {
            AutoInit.Init();
            TypeRegister.Init();

            RoutingRule.DistrictsName = ConfigManager.DistrictsName();

            zkAdaptor = new ZkAdaptor();
            //amqpAdaptor = new AmqpAdaptor(ConfigManager.MQIP(), ConfigManager.AMQPPort(),
            //    ConfigManager.MQUser(), ConfigManager.MQPass());

            //ServiceImplementStub.Bind<LogicClientServiceImpl, ILogicClientImpl>(amqpAdaptor, new LogicClientServiceImpl());
            ServiceImplementStub.Bind <IDbClientNotifyImpl>(zkAdaptor, new NotifyServiceImpl());

            //Logic2CliService = new ClientLogicServiceDelegate(amqpAdaptor);
            //loginNotifyDelegate = new LoginNotifyDelegate(amqpAdaptor);
            //SchedulerLogicService = new SchedulerLogicServiceDelegate(amqpAdaptor);

            dbClientNotifyDelegate = new DbClientNotifyDelegate(zkAdaptor);

            //ConfigManager.RegisterParser(new ConfigManager.ConfigParserDelegate<EndPoint>(s =>
            //{
            //    var rets = s.Split(':');
            //    var host = rets[0];
            //    var port = 0;

            //    int.TryParse(rets[1], out port);

            //    IPAddress ip;
            //    if (IPAddress.TryParse(host, out ip))
            //    {
            //        return new IPEndPoint(ip, port);
            //    }

            //    return new DnsEndPoint(host, port);
            //}));

            CacheService = new RedisDataServiceDelegate(new RedisAdaptor(ConfigManager.Instance.Read <List <EndPoint> >("DataService", "CacheConn")));
            //DbService = new MysqlDataServiceDelegate(new MysqlAdaptor(ConfigManager.DbIP(), ConfigManager.DbName(), ConfigManager.DbUser(), ConfigManager.DbPass()));

            zkAdaptor.BeginReceive();
            //amqpAdaptor.BeginReceive();

            zkAdaptor.Identity("Logic");

            //Heartbeat();
        }
Example #5
0
        static void Main(string[] args)
        {
            RedisAdaptor = new RedisAdaptor(ConfigManager.CacheConn());
            MysqlAdaptor = new MysqlAdaptor(ConfigManager.DbIP(), ConfigManager.DbName(), ConfigManager.DbUser(), ConfigManager.DbPass());

            CacheDataService       = new RedisDataServiceDelegate(RedisAdaptor);
            PersistenceDataService = new MysqlDataServiceDelegate(MysqlAdaptor);

            while (true)
            {
                Console.WriteLine("begin check...");
                Console.WriteLine(ThreadInfo());

                Work().Wait();

                Thread.Sleep(TimeSpan.FromSeconds(30));
            }
        }
Example #6
0
        static void Main(string[] args)
        {
            RedisAdaptor = new RedisAdaptor(ConfigManager.CacheConn());
            MysqlAdaptor = new MysqlAdaptor(ConfigManager.DbIP(), ConfigManager.DbName(), ConfigManager.DbUser(), ConfigManager.DbPass());
            
            CacheDataService = new RedisDataServiceDelegate(RedisAdaptor);
            PersistenceDataService = new MysqlDataServiceDelegate(MysqlAdaptor);

            while (true)
            {
                Console.WriteLine("begin check...");
                Console.WriteLine(ThreadInfo());

                Work().Wait();

                Thread.Sleep(TimeSpan.FromSeconds(30));
            }
        }