Exemple #1
0
        private AnnoKV GetAnnoKV(string key)
        {
            Dictionary <string, string> input = new Dictionary <string, string>();

            input[StorageCommand.COMMAND] = StorageCommand.KVCOMMAND;
            input[KVCONST.Opt]            = KVCONST.FindById;
            input[KVCONST.Id]             = key;
            var rltStr = client.Invoke(input);
            var rlt    = Newtonsoft.Json.JsonConvert.DeserializeObject <AnnoDataResult <AnnoKV> >(rltStr);

            if (rlt.Status == false)
            {
                throw new InvalidOperationException(rlt.Msg);
            }
            return(rlt.Data);
        }
Exemple #2
0
        public static string Invoke(Dictionary <string, string> input)
        {
            TTransport transport = new TSocket(SettingService.Local.IpAddress, SettingService.Local.Port, 30000);
            TProtocol  protocol  = new TBinaryProtocol(transport);

            BrokerCenter.Client client = new BrokerCenter.Client(protocol);
            transport.Open();
            var rlt = client.Invoke(input);

            transport.Close();
            transport.Dispose();
            return(rlt);
        }