rpc_client.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:_ 作者: zengchunyun 项目源码 文件源码
def call(self, n):
        self.response = None
        self.corr_id = str(uuid.uuid4())
        self.channel.basic_publish(exchange="",
                                   routing_key="rpc_queue",
                                   properties=pika.BasicProperties(
                                       reply_to=self.callback_queue,
                                       correlation_id=self.corr_id,
                                   ),
                                   body=str(n))
        while self.response is None:
            self.connection.process_data_events()
        return int(self.response)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号