All Projects → Thriftpy → Thrift_connector

Thriftpy / Thrift_connector

Licence: mit
Clients of thrift, utilizing connection pools

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Thrift connector

Node Thrift2 Hbase
An HBase thrift wrapper for Node.js
Stars: ✭ 18 (-75.68%)
Mutual labels:  thrift
Node Server Project
基于 node.js + express 技术栈,采用MVC结构设计、JWT + RESTful API、PM2服务监控的Node服务器端项目框架.
Stars: ✭ 47 (-36.49%)
Mutual labels:  thrift
Tchannel
network multiplexing and framing protocol for RPC
Stars: ✭ 1,122 (+1416.22%)
Mutual labels:  thrift
Rpc proxy
基于thrift的服务注册和发现框架
Stars: ✭ 13 (-82.43%)
Mutual labels:  thrift
Spring Thrift Api Gateway
Gateway for Apache Thrift requests processing that is built on Spring Cloud stack
Stars: ✭ 38 (-48.65%)
Mutual labels:  thrift
Tns
tns provides distributed solutions for thrift, support service discovery, high availability, load balancing, the gray release, horizontal scaling, and so on.
Stars: ✭ 53 (-28.38%)
Mutual labels:  thrift
Scrooge
A Thrift parser/generator
Stars: ✭ 724 (+878.38%)
Mutual labels:  thrift
Andl
Andl is A New Database Language
Stars: ✭ 71 (-4.05%)
Mutual labels:  thrift
Thrift2flow
Converts Thrift specs into Flow JavaScript type definitions
Stars: ✭ 39 (-47.3%)
Mutual labels:  thrift
Nettythrift
Thrift on Netty, support TCP/HTTP/WebSocket at same port. support multiple Protocols at same time. multil Simple Clients with Connection Pool.
Stars: ✭ 60 (-18.92%)
Mutual labels:  thrift
Pucket
Bucketing and partitioning system for Parquet
Stars: ✭ 29 (-60.81%)
Mutual labels:  thrift
Thriftclientpool
a thrift client connection pool & simple thrift use demo by golang
Stars: ✭ 32 (-56.76%)
Mutual labels:  thrift
Thrift
Apache Thrift
Stars: ✭ 8,821 (+11820.27%)
Mutual labels:  thrift
Impala Java Client
Java client to connect directly to Impala using thrift
Stars: ✭ 26 (-64.86%)
Mutual labels:  thrift
Thriftpy
Thriftpy has been deprecated, please migrate to https://github.com/Thriftpy/thriftpy2
Stars: ✭ 1,156 (+1462.16%)
Mutual labels:  thrift
Zys
high performance service framework based on Yaf or Swoole
Stars: ✭ 812 (+997.3%)
Mutual labels:  thrift
Finagle
A fault tolerant, protocol-agnostic RPC system
Stars: ✭ 8,126 (+10881.08%)
Mutual labels:  thrift
Sails
Create a Thrift Server use like Rails
Stars: ✭ 72 (-2.7%)
Mutual labels:  thrift
Hs2client
C++ native client for Impala and Hive, with Python / pandas bindings
Stars: ✭ 69 (-6.76%)
Mutual labels:  thrift
Thrift Connection Pool
Apache Thrift客户端连接池(client connection pool)
Stars: ✭ 59 (-20.27%)
Mutual labels:  thrift

Thrift Connector

Simple connection pool for thrift. thrift_connector can be used both for native thrift client and thriftpy client with minor difference in usage.

Examples can be found in examples as well as the following sections.

How it works

It maintains a connection pool, and it'll do a precheck(calling ping) to validate the connection to ensure the connection is always usable.

Options

service Defined thrift service. It should be the container class of apis for thriftpy (thriftpy2.load('...').XXXService), and api module for thrift (XXX_sdk.xxx.xxxService) host Server host port Server port [timeout] Socket timeout, in seconds. [name] Connection pool name, for identity. [raise_empty] Whether to raise exception if pool is empty while trying to obtain a connection. [max_conn] Number of connections to manage in pool. [connection_class] Connection class implementation. Builtin classes are: ThriftClient for native thrift, ThriftPyClient and ThriftPyCyClient for thriftpy, the latter one utilizes Cython for better performance. [keepalive] Seconds each connection is able to stay alive. If oen connection has lived longer than this period, it will be closed.

Usage

Examples for thriftpy is:

.. code:: python

import thriftpy2
import thrift_connector.connection_pool as connection_pool

service = thriftpy2.load("pingpong_app/pingpong.thrift")
pool = connection_pool.ClientPool(
    service.PingService,
    'localhost',
    8880,
    connection_class=connection_pool.ThriftPyCyClient
    )

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

Examples for thrift is:

.. code:: python

# -*- coding: utf-8 -*-

from pingpong_app.pingpong_sdk.pingpong import PingService
import connection_pool

pool = connection_pool.ClientPool(
    PingService,
    'localhost',
    8880,
    connection_class=connection_pool.ThriftClient
    )

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

Examples for Tornado clients can be found in examples.

Test

.. code:: python

py.test tests
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].