在远程邮箱处理器之间传递消息?

发布于 2024-10-15 01:10:46 字数 145 浏览 2 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萝莉病 2024-10-22 01:10:46

我认为您将编写自己的例程来序列化消息,将它们传递到进程边界,然后将它们分派到另一侧。这还需要实现一个 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文