コード例 #1
0
ファイル: QueryF.py プロジェクト: walkertest/TarsTup
    def async_findObjectById4All(self,
                                 callback,
                                 id,
                                 context=ServantProxy.mapcls_context()):
        oos = tarscore.TarsOutputStream()
        oos.write(tarscore.string, 1, id)

        self.tars_invoke_async(ServantProxy.TARSNORMAL, "findObjectById4All",
                               oos.getBuffer(), context, None, callback)
コード例 #2
0
ファイル: QueryF.py プロジェクト: walkertest/TarsTup
    def findObjectById(self, id, context=ServantProxy.mapcls_context()):
        oos = tarscore.TarsOutputStream()
        oos.write(tarscore.string, 1, id)

        rsp = self.tars_invoke(ServantProxy.TARSNORMAL, "findObjectById",
                               oos.getBuffer(), context, None)

        ios = tarscore.TarsInputStream(rsp.sBuffer)
        ret = ios.read(tarscore.vctclass(EndpointF), 0, True)

        return (ret)
コード例 #3
0
ファイル: QueryF.py プロジェクト: walkertest/TarsTup
    def findObjectByIdInSameGroup(self,
                                  id,
                                  context=ServantProxy.mapcls_context()):
        oos = tarscore.TarsOutputStream()
        oos.write(tarscore.string, 1, id)
        rsp = self.tars_invoke(ServantProxy.TARSNORMAL,
                               "findObjectByIdInSameGroup", oos.getBuffer(),
                               context, None)

        startDecodeTime = time.time()
        ios = tarscore.TarsInputStream(rsp.sBuffer)
        ret = ios.read(tarscore.int32, 0, True)
        activeEp = ios.read(tarscore.vctclass(EndpointF), 2, True)
        inactiveEp = ios.read(tarscore.vctclass(EndpointF), 3, True)
        endDecodeTime = time.time()
        return (ret, activeEp, inactiveEp, (endDecodeTime - startDecodeTime))
コード例 #4
0
ファイル: QueryF.py プロジェクト: walkertest/TarsTup
    def findObjectByIdInSameSet(self,
                                id,
                                setId,
                                context=ServantProxy.mapcls_context()):
        oos = tarscore.TarsOutputStream()
        oos.write(tarscore.string, 1, id)
        oos.write(tarscore.string, 2, setId)

        rsp = self.tars_invoke(ServantProxy.TARSNORMAL,
                               "findObjectByIdInSameSet", oos.getBuffer(),
                               context, None)

        ios = tarscore.TarsInputStream(rsp.sBuffer)
        ret = ios.read(tarscore.int32, 0, True)
        activeEp = ios.read(tarscore.vctclass(EndpointF), 3, True)
        inactiveEp = ios.read(tarscore.vctclass(EndpointF), 4, True)

        return (ret, activeEp, inactiveEp)
コード例 #5
0
    def popRequest(self):
        '''
        @brief: 返回消息队列里的请求响应报文,FIFO
                不删除TimeoutQueue里的数据,响应时要用
        @return: 请求响应报文
        @rtype: ReqMessage
        '''
        return self.__timeoutQueue.pop(erase=False)


if __name__ == '__main__':
    connAddr = "apptest.lightServer.lightServantObj@tcp -h 10.130.64.220 -p 10001 -t 10000"
    connAddr = 'MTT.BookMarksUnifyServer.BookMarksUnifyObj@tcp -h 172.17.149.77 -t 60000 -p 10023'
    comm = Communicator()
    comm.initialize()
    servant = ServantProxy()
    servant = comm.stringToProxy(connAddr, servant)
    print servant.tars_timeout()
    try:
        rsp = servant.tars_invoke(ServantProxy.TARSNORMAL, "test", '',
                                  ServantProxy.mapcls_context(), None)
        print 'Servant invoke success, request id: %d, iRet: %d' % (
            rsp.iRequestId, rsp.iRet)
    except Exception, msg:
        print msg
    finally:
        servant.tars_terminate()
    time.sleep(2)
    print 'app closing ...'
    comm.terminate()
    time.sleep(2)