|
|
OverviewIt is a transparent RPC (remoting) technology for Java. You can publish an object to one or more remote clients via one of the interfaces it implements. It is best to honor the Facade Pattern while architecting the interface(s) as an RPC call over TCP/IP is not cheap. JRemoting is Apache 2.0 licensed open source. It is inspired by .Net Remoting and before that the no-longer available Mind Electric Glue technology. JRemoting has been in development since 2002 and for no good reason was not released as 1.0 until 2008. Here is an example of a simple facade-style interface and a POJO implementation of it:
public interface Bank {
void credit(BigDecimal amount);
void debit(BigDecimal amount);
}
public Bank implements BankImpl {
// fields
public void credit(BigDecimal amount) {
// etc
}
public void debit(BigDecimal amount) {
// etc
}
// other methods
}
Server side publishing
Bank myBank = new BankImpl();
server = new SocketServer(new ConsoleServerMonitor(), new InetSocketAddress(10333));
server.publish(myBank, "BankService", Bank.class);
server.start();
Client side usage
serviceResolver = new ServiceResolver(new SocketTransport(new ConsoleClientMonitor(), new SocketDetails("localhost", 10333)));
PluggabilityJRemoting is designed to have pluggable implementations of its component parts. Explore the left navigation to see what is pluggable. |