def __init__(self):
     self.log = {}
     self.AccountInformationClient = connection_pool.ClientPool(
         bank_thrift.AccountInformation,
         'account-information',
         9090,
         connection_class=connection_pool.ThriftPyCyClient)
     self.MoneyTransferClient = connection_pool.ClientPool(
         bank_thrift.MoneyTransfer,
         'money-transfer',
         9090,
         connection_class=connection_pool.ThriftPyCyClient)
Beispiel #2
0
 def __init__(self):
     self.log = {}
     self.ContactInformationClient = connection_pool.ClientPool(
         bank_thrift.ContactInformation,
         'contact-information',
         9090,
         connection_class=connection_pool.ThriftPyCyClient)
     self.RegisteredProductsClient = connection_pool.ClientPool(
         bank_thrift.RegisteredProducts,
         'registered-products',
         9090,
         connection_class=connection_pool.ThriftPyCyClient)
Beispiel #3
0
 def __init__(self):
     self.log = {}
     self.TransactionHistoryClient = connection_pool.ClientPool(
       bank_thrift.TransactionHistory,
       'transaction-history', 9090,
       connection_class=connection_pool.ThriftPyCyClient
     )
     self.PaymentAuthorizationClient = connection_pool.ClientPool(
       bank_thrift.PaymentAuthorization,
       'payment-authorization', 9090,
       connection_class=connection_pool.ThriftPyCyClient
     )
Beispiel #4
0
 def __init__(self):
     self.log = {}
     self.RegisteredProductsDBClient = connection_pool.ClientPool(
       bank_thrift.RegisteredProductsDB,
       'registered-products-db', 9090,
       connection_class=connection_pool.ThriftPyCyClient
     )
 def __init__(self):
     self.log = {}
     self.PaymentAuthorizationDBClient = connection_pool.ClientPool(
         bank_thrift.PaymentAuthorizationDB,
         'payment-authorization-db',
         9090,
         connection_class=connection_pool.ThriftPyCyClient)
 def __init__(self):
     self.log = {}
     self.AccountInformationDBClient = connection_pool.ClientPool(
       bank_thrift.AccountInformationDB,
       'account-information-db', 9090,
       connection_class=connection_pool.ThriftPyCyClient
     )
Beispiel #7
0
def initialize_iamadmin_client_pool(host, port):
    iamadmin_client_pool = connection_pool.ClientPool(
        IamAdminServices,
        host,
        port,
        connection_class=IAMAdminServiceThriftClient,
        keepalive=settings.THRIFT_CLIENT_POOL_KEEPALIVE
    )
    return iamadmin_client_pool
Beispiel #8
0
 def get_proceesor_by_lang(self, lang):
     distincter = "%s-%s" % (self.thrift_cls.__name__, lang)
     processor = mp_processor_lang_mapping.get(distincter)
     if processor:
         return processor
     host, port = self.processor_location_lang_mapping[lang]
     processor = connection_pool.ClientPool(self.thrift_cls, \
         host, port, connection_class=connection_pool.ThriftPyCyClient)
     mp_processor_lang_mapping[distincter] = processor
     return processor
Beispiel #9
0
def initialize_api_client_pool(
        host=default_api_server_settings.API_SERVER_HOST,
        port=default_api_server_settings.API_SERVER_PORT,
        is_secure=default_api_server_settings.API_SERVER_SECURE):
    AiravataAPIThriftClient.secure = is_secure
    airavata_api_client_pool = connection_pool.ClientPool(
        Airavata,
        host,
        port,
        connection_class=AiravataAPIThriftClient,
        keepalive=thrift_settings.THRIFT_CLIENT_POOL_KEEPALIVE)
    return airavata_api_client_pool
Beispiel #10
0
def initialize_group_manager_client(host=default_group_manager_client_settings.PROFILE_SERVICE_HOST,
                                    port=default_group_manager_client_settings.PROFILE_SERVICE_PORT,
                                    is_secure=default_group_manager_client_settings.PROFILE_SERVICE_SECURE):
    GroupManagerServiceThriftClient.secure = is_secure
    group_manager_client_pool = connection_pool.ClientPool(
        GroupManagerService,
        host,
        port,
        connection_class=GroupManagerServiceThriftClient,
        keepalive=thrift_settings.THRIFT_CLIENT_POOL_KEEPALIVE
    )
    return group_manager_client_pool
Beispiel #11
0
def initialize_iam_admin_client(
        host=default_iam_client_settings.PROFILE_SERVICE_HOST,
        port=default_iam_client_settings.PROFILE_SERVICE_PORT,
        is_secure=default_iam_client_settings.PROFILE_SERVICE_SECURE):
    IAMAdminServiceThriftClient.secure = is_secure
    iamadmin_client_pool = connection_pool.ClientPool(
        IamAdminServices,
        host,
        port,
        connection_class=IAMAdminServiceThriftClient,
        keepalive=thrift_settings.THRIFT_CLIENT_POOL_KEEPALIVE)
    return iamadmin_client_pool
Beispiel #12
0
def initialize_user_profile_client(
        host=default_user_profile_server_settings.PROFILE_SERVICE_HOST,
        port=default_user_profile_server_settings.PROFILE_SERVICE_PORT,
        is_secure=default_user_profile_server_settings.PROFILE_SERVICE_SECURE):
    UserProfileServiceThriftClient.secure = is_secure
    user_profile_client_pool = connection_pool.ClientPool(
        UserProfileService,
        host,
        port,
        connection_class=UserProfileServiceThriftClient,
        keepalive=thrift_settings.THRIFT_CLIENT_POOL_KEEPALIVE)
    return user_profile_client_pool
Beispiel #13
0
def initialize_credential_store_client(host=default_credential_store_client_settings.CREDENTIAL_STORE_API_HOST,
                                       port=default_credential_store_client_settings.CREDENTIAL_STORE_API_PORT,
                                       is_secure=default_credential_store_client_settings.CREDENTIAL_STORE_API_SECURE):
    CredentialStoreService.secure = is_secure

    credential_store_api_client_pool = connection_pool.ClientPool(
        CredentialStoreService,
        host,
        port,
        connection_class=CredentialStoreServiceThriftClient,
        keepalive=thrift_settings.THRIFT_CLIENT_POOL_KEEPALIVE
    )
    return credential_store_api_client_pool
Beispiel #14
0
def initialize_sharing_registry_client(
        host=default_sharing_API_client_settings.SHARING_API_HOST,
        port=default_sharing_API_client_settings.SHARING_API_PORT,
        is_secure=default_sharing_API_client_settings.SHARING_API_SECURE):
    SharingAPIThriftClient.secure = is_secure

    sharing_api_client_pool = connection_pool.ClientPool(
        SharingRegistryService,
        host,
        port,
        connection_class=SharingAPIThriftClient,
        keepalive=thrift_settings.THRIFT_CLIENT_POOL_KEEPALIVE)
    return sharing_api_client_pool
Beispiel #15
0
 def setup_method(self, method):
     Logger.logMethodName(method.__name__)
     constant.config['requestId'] = 'luci_auto_' + str(
         random.randint(11111, 99999))
     self.coupon_series_id = -1
     self.tillId = constant.config['tillIds'][0]
     self.billId = str(random.randint(11111, 99999))
     self.queue = Queue()
     self.lock = threading.Lock()
     # create connection pool
     port = constant.config['luciPort'].next()
     self.connObj = connection_pool.ClientPool(
         luci.LuciService,
         '127.0.0.1',
         port,
         connection_class=connection_pool.ThriftPyCyClient,
         timeout=150)
     self.s = sched.scheduler(time.time, time.sleep)
Beispiel #16
0
from datetime import datetime
import thriftpy
from thriftpy.rpc import client_context
import thrift_connector.connection_pool as connection_pool


_LOG_FILE = 'saltlake.log'
goods = thriftpy.load("../services/def/goods.thrift", module_name="goods_thrift")


if __name__ == '__main__':
    logging.basicConfig(filename = _LOG_FILE, level = logging.INFO)
    logging.getLogger().addHandler(logging.StreamHandler())

    reload(sys)
    sys.setdefaultencoding("utf8")

    logging.info('[client] ===========================================')
    logging.info('[client] running at %s' % datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"))
    logging.info('client] ===========================================')

    pool = connection_pool.ClientPool(
        goods.GoodsService,
        'localhost',
        8000,
        connection_class=connection_pool.ThriftPyCyClient
    )

    for i in range(100):
        print pool.getCategories(3724)
Beispiel #17
0
    secure = settings.PROFILE_SERVICE_SECURE


class UserProfileServiceThriftClient(MultiplexThriftClientMixin,
                                     CustomThriftClient):
    service_name = USER_PROFILE_CPI_NAME
    secure = settings.PROFILE_SERVICE_SECURE


class SharingAPIThriftClient(CustomThriftClient):
    secure = settings.SHARING_API_SECURE


airavata_api_client_pool = connection_pool.ClientPool(
    Airavata,
    settings.AIRAVATA_API_HOST,
    settings.AIRAVATA_API_PORT,
    connection_class=AiravataAPIThriftClient,
    keepalive=settings.THRIFT_CLIENT_POOL_KEEPALIVE)
group_manager_client_pool = connection_pool.ClientPool(
    GroupManagerService,
    settings.PROFILE_SERVICE_HOST,
    settings.PROFILE_SERVICE_PORT,
    connection_class=GroupManagerServiceThriftClient,
    keepalive=settings.THRIFT_CLIENT_POOL_KEEPALIVE)
iamadmin_client_pool = connection_pool.ClientPool(
    IamAdminServices,
    settings.PROFILE_SERVICE_HOST,
    settings.PROFILE_SERVICE_PORT,
    connection_class=IAMAdminServiceThriftClient,
    keepalive=settings.THRIFT_CLIENT_POOL_KEEPALIVE)
tenant_profile_client_pool = connection_pool.ClientPool(
Beispiel #18
0
import thriftpy
import thrift_connector.connection_pool as connection_pool

service = thriftpy.load("pingpong.thrift")
pool = connection_pool.ClientPool(
    service.PingService,
    'localhost',
    6000,
    connection_class=connection_pool.ThriftPyCyClient)

print "Sending Ping..."
print "Receive:", pool.ping()
print "Winning the match..."
print "Receive:", pool.win()