Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat's a good Java-based Master-Slave communication mechanism?
    text
    copied!<p>I'm creating a Java application that requires master-slave communication between JVMs, possibly residing on the same physical machine. There will be a "master" server running inside a Java EE application server (i.e. JBoss) that will have "slave" clients connect to it and dynamically register itself for communication (that is the master will not know the IP addresses/ports of the slaves so cannot be configured in advance). The master server acts as a controller that will dole work out to the slaves and the slaves will periodically respond with notifications, so there would be bi-directional communication.</p> <p>I was originally thinking of RPC-based systems where each side would be a server, but it could get complicated, so I'd prefer a mechanism where there's an open socket and they talk back and forth.</p> <p>I'm looking for a communication mechanism that would be low-latency where the messages would be mostly primitive types, so no serious serialization is necessary. Here's what I've looked at:</p> <ul> <li>RMI</li> <li>JMS: Built-in to Java, the "slave" clients would connect to the existing ConnectionFactory in the application server.</li> <li>JAX-WS/RS: Both master and slave would be servers exposing an RPC interface for bi-directional communication.</li> <li>JGroups/Hazelcast: Use shared distributed data structures to facilitate communication.</li> <li>Memcached/MongoDB: Use these as "queues" to facilitate communication, though the clients would have to poll so there would be some latency.</li> <li>Thrift: This does seem to keep a persistent connection, but not sure how to integrate/embed a Thrift server into JBoss</li> <li>WebSocket/Raw Socket: This would work, but require a lot more custom code than I'd like.</li> </ul> <p>Is there any technology I'm missing?</p> <p><strong>Edit:</strong> Also looked at:</p> <ul> <li>JMX: Have the client connect to JBoss' JMX server and receive JMX notifications for bidirectional comms.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload