开发者

Manage out-of-JVM agent pool and communication

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 librar开发者_C百科y to assist here ?

I could very well write what I need myself but I'm sure other people have done that way better already.


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.


You could try Hessian:

http://hessian.caucho.com/

or Preon:

http://preon.sourceforge.net/


I've actually found two ways that would have been of great help when I developed this:

  1. WebSockets. I used simple sockets but then I needed to reinvent signaling to check who's sending and done sending things. I used a line-based approach but it's really ugly. WebSockets offer the message-based communication and that's great.
  2. Hazelcast. This is a "distributed system" and offers great things like distributed executors (I schedule a message to be sent in the app server and let any available out-of-jvm agent handle it, atomically), shared and thread safe hashmaps (to keep track of who is running) etc. Many of the similar tools I had seen were either in native code (like ZeroMQ btw) or with per-CPU licenses and such. Hazelcast is community edition and can be bundled into my apps.

Actually, I had started using vert.x to handle websocket-based communication and realized it was itself using hazelcast.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜