开发者

Bidirectional Java clients/servers communication

I am trying to design a distributed application in Java with a few servers and a few managers (applications monitoring and configuring the servers). Most of the traffic between the servers and the managers will be request from the managers to the servers, but the servers should be able to notify the managers when something happen. The managers don't care about each other, and the servers don't care about each other, but the managers should manage all the running servers and the servers should be managed by all the running managers. I don't want to have every request go through a central entity.

What is the best way to implement the communication link between this?

What I thought of:

  • RESTful API: Unidirectional communication, so we need polling, which is less responsive and waste a lot of resources.

  • Opening a Socket between each server/manager pair: Looks like the best way to me, but I feel like I would be re-inventing the whe开发者_StackOverflow中文版el...

  • Java RMI: Looks nice but it needs a central entity (rmiregistry). Plus, I'm stuck with Java if I use it, and it looks like it's more adapted for a point-to-point communication.

  • JMS: Same thing, it needs a central entity (JMS Provider), and it's Java only...

Thanks!


Look at AMPQ / RabbitMQ

  1. RabbitMQ can be clustered - see http://www.rabbitmq.com/clustering.html
  2. It have bindings for most programming languages

and also it very fast, scalable and stable


The JMS broker is Java only, but the clients can be just about anything.

If you don't want a central entity you can have an embedded broker or broker dedicated to each server.

I would use ActiveMQ because its one of the easiest to get started with (and fast)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜