Python Twisted - 预期代理和服务器端延迟
背景: 我有一个 gtk 客户端,它使用扭曲和透视代理来执行远程对象执行和服务器/客户端通信。这对我来说非常有用,并且开始工作很容易。
我有 amqp(消息队列/MQ)服务,我也需要与客户端进行通信。 我通过twisted在客户端和服务器周围建立了一个安全模型,并且我不希望客户端直接与消息队列服务器对话,也不希望客户端对amqp库有另一个依赖。
理想情况下,我希望客户端通过透视代理向服务器发送请求,透视代理服务器代表客户端向另一台服务器发送 amqp 请求,并且当 PB 服务器收到响应时,客户端收到确认消息队列服务器。
问题: 在服务器端,如何推迟服务器 pb 方法之一内的响应? 更重要的是,将传出请求连接回传入请求并仍然保留 Twisted 事件驱动范例的最有效方法是什么?
Background:
I have a gtk client that uses twisted and perspective broker to perform remote object execution and server/client communication. This works great for me and was a breeze to start working with.
I have amqp (Message Queue/MQ) services that I also need to communicate from the client.
I have a security model in place around the client and server through twisted, and I don't want the clients to talk to the Message Queue Server directly, nor do I want another dependency on amqp libraries for the clients.
Ideally I would like the client to send a request to the server through perspective broker, the Perspective Broker Server to send an amqp request to another server on behalf of the client, and the client to receive an acknowledgment when the PB server receives a response from the Message Queue Server.
Question:
On the server side, how do I defer the response inside one of the servers pb methods?
More importantly what's the most efficient way to connect an outgoing request back to an incoming request and still preserve the Twisted event driven paradigms?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单的。从
remote_
方法返回Deferred
。完毕。Easy. Return the
Deferred
from theremote_
method. Done.