在远程邮箱处理器之间传递消息?
我使用 MailboxProcessor 类来保持单独的代理做自己的事情。通常代理可以在同一进程中相互通信,但我希望代理在不同进程甚至不同机器上时能够相互通信。什么样的机制最适合实现它们之间的通信?有标准溶液吗?
请注意,我使用 Ubuntu 实例来运行代理。
I'm using MailboxProcessor
classes in order to keep separate agents that do their own thing. Normally agents can communicate with one another in the same process, but I want agents to talk to one another when they are on separate processes or even different machines. What kind of mechanism is best for implementing communication between them? Is there some standard solution?
Please note that I'm using Ubuntu instances to run the agents.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您将编写自己的例程来序列化消息,将它们传递到进程边界,然后将它们分派到另一侧。这还需要实现一个 ID 系统,其中每个邮箱都有一个 ID,并且进程可以将消息发送到 ID,而不仅仅是 Mailbox.Send。这并不容易,因为本地邮箱将能够访问本地内存,但远程邮箱则不能。
我会看看像 RPyC (http://rpyc.wikidot.com/) 这样的东西,因为它提供了一个有点像你正在寻找的协议。
基本上答案是“不”,没有真正的好方法可以做到这一点。
I think you're going to have write your own routines to serialize messages, pass them accross the process boundaries and then dispatch them on the other side. This will also require a implementation of a ID system where each mailbox has an ID and processes can send messages to IDs instead of just Mailbox.Send. This is not easy, as local boxes will be able to access local memory, but remote mailboxes will not.
I would look at something like RPyC (http://rpyc.wikidot.com/) as it provides a protocol somewhat like you are looking for.
Basically the answer is 'no' there isn't really a good way to do this.