Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thrift_connector 支持multiplexer有用例吗 #50

Open
smzhao opened this issue Oct 24, 2018 · 1 comment
Open

thrift_connector 支持multiplexer有用例吗 #50

smzhao opened this issue Oct 24, 2018 · 1 comment

Comments

@smzhao
Copy link

smzhao commented Oct 24, 2018

一直没有对接成功,

@engigu
Copy link

engigu commented Oct 13, 2020

class TMultiplexedThriftClient(connection_pool.ThriftClient):
    server_name = ''

    @classmethod
    def get_protoco_factory(self):
        # from thrift.protocol.TMultiplexedProtocol import TMultiplexedProtocol
        def tmpl(transport):
            return TMultiplexedProtocol(TBinaryProtocol.TBinaryProtocol(transport), self.server_name)

        return tmpl

    @classmethod
    def get_transport_factory(self):
        # from thrift.transport import TTransport
        return TTransport.TFramedTransport


class CommonTMultiplexedThriftClient(TMultiplexedThriftClient):
    server_name = 'CommonApiService'


pool = connection_pool.ClientPool(
    CommonRpcApiService,
    host,
    port,
    connection_class=CommonTMultiplexedThriftClient,
    keepalive=120,
    max_conn=10
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants