管理 JVM 外代理池和通信
我需要从我的应用程序管理一组代理。所有这些都是用 Java 编写的,但代理需要在自己的 JVM 中运行。我编写了一个概念证明,它启动子进程并使用 stdout/stdin 发送命令和保持活动信息。我还打开一个套接字连接进行数据传输。
我想一些连接池库应该能够帮助管理代理。
代理和主进程之间的通信怎么样?使用 TCP 和 XML 消息 (JAXB) 并不像我希望的那样可靠或方便。对于更好的图书馆有什么建议可以在这里提供帮助吗?
我自己可以很好地写出我需要的内容,但我确信其他人已经做得更好了。
I need to managed a pool of agents from my application. All are written in Java but the agents need to run in their own JVM. I wrote a proof of concept that starts the subprocesses and uses the stdout/stdin to send commands and keep-alive information. I also open a socket connection for data transfer.
I guess that some connection pooling libraries should be able to help in the management of the agents.
What about the communication between the agents and the main process ? Using TCP with XML messages (JAXB) is not really as reliable or convenient as I would like. Any suggestion for a better library to assist here ?
I could very well write what I need myself but I'm sure other people have done that way better already.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于消息传递,可以尝试类似 ZeroMQ 的东西,它是一个消息传递工具,并且具有用于进程之间通信的本地传输,然后您只能在进程之间序列化对象。
另一种选择是回到传统的 rmi,这可能是最简单的。
For messaging could try something like ZeroMQ, it's a messaging tool and has local transports for communicationg between processes, then you could just serialised objects between the process.
The alternative is to go back to traditionally rmi, probably the simplest.
您可以尝试 Hessian:
http://hessian.caucho.com/
或 Preon:
http://preon.sourceforge.net/
You could try Hessian:
http://hessian.caucho.com/
or Preon:
http://preon.sourceforge.net/
实际上,我发现了两种对我开发此程序有很大帮助的方法:
实际上,我已经开始使用 vert.x 来处理基于 websocket 的通信,并意识到它本身就是使用 hazelcast。
I've actually found two ways that would have been of great help when I developed this:
Actually, I had started using vert.x to handle websocket-based communication and realized it was itself using hazelcast.