@defer.inlineCallbacks
    def createThriftClient(self, responsesExchange, serviceExchange,
        routingKey, clientClass, channel=1, responseQueue=None, iprot_factory=None,
        oprot_factory=None):

        channel = yield self.channel(channel)

        if responseQueue is None:
            reply = yield channel.queue_declare(exclusive=True,
                auto_delete=True)

            responseQueue = reply.queue

            yield channel.queue_bind(queue=responseQueue,
                exchange=responsesExchange, routing_key=responseQueue)

        reply = yield channel.basic_consume(queue=responseQueue)

        log.msg("Consuming messages on queue: %s" % responseQueue)

        thriftClientName = clientClass.__name__ + routingKey
        
        amqpTransport = TwistedAMQPTransport(
            channel, serviceExchange, routingKey, clientName=thriftClientName,
            replyTo=responseQueue, replyToField=self.replyToField)

        if iprot_factory is None:
            iprot_factory = self.factory.iprot_factory

        if oprot_factory is None:
            oprot_factory = self.factory.oprot_factory

        thriftClient = clientClass(amqpTransport, oprot_factory)

        queue = yield self.queue(reply.consumer_tag)
        d = queue.get()
        d.addCallback(self.parseClientMessage, channel, queue, thriftClient,
            iprot_factory=iprot_factory)
        d.addErrback(self.catchClosedClientQueue)
        d.addErrback(self.handleClientQueueError)


        basicReturnQueue = yield self.thriftBasicReturnQueue(thriftClientName)
        
        d = basicReturnQueue.get()
        d.addCallback(self.parseClientUnrouteableMessage, channel,
            basicReturnQueue, thriftClient, iprot_factory=iprot_factory)
        d.addErrback(self.catchClosedClientQueue)
        d.addErrback(self.handleClientQueueError)

        defer.returnValue(thriftClient)
dataset/ETHPy150Open tweetdeck/txAMQP/src/txamqp/contrib/thrift/protocol.py/ThriftAMQClient.createThriftClient/original