cxRmi library

The cxRmi library is Message Oriented Middleware (MOM) and allows for Remote Method Invocation (RMI) over TCP/IP.

Remote Method Invocation

A stub acts as a local proxy of the remote object, enabling clients to make calls on the remote object (the receiver) as if it were local.

A skeleton is responsible for translating incoming messages to calls on the receiver object.

The implementation is layered on top of MultiplexedMsgConnection which supports multiplexed messages over TCP/IP.

A $interface with the 'rmi' qualifier is used to define the message protocol on some interface.

The cxRmi layer is intentionally a simple, lightweight high performance middleware layer:

Although the following are not supported they could easily be layered on top:

Sending side

On the stub side the following steps are used to send messages for some interface Ix.

  1. Obtain a MultiplexedMsgConnection
  2. Call CreateRmiCaller<Ix>() to create an RmiCaller which will send messages over the given MultiplexedMsgConnection
  3. Create an object that implements interface IRmiCallerHandler, that will receive notifications of when the MultiplexedMsgConnection is ready to receive more messages for the purpose of throttling the producer. Call SetHandler() on the RmiCaller.
  4. Call GetStub<Ix>() on the RmiCaller to retrieve the client side stub which implements interface Ix
  5. Make synchronous or asynchronous calls through the stub as required.

Receiving side

On the skeleton side the following steps are used to receive messages for some interface Ix.

  1. Obtain a MultiplexedMsgConnection
  2. Create an object that implements the rmi interface, that will receive incoming messages
  3. Call CreateRmiCallee<Ix>() to create and bind a skeleton to the MultiplexedMsgConnection for the given interface, and which will translate incoming messages to calls on the receiver object

Memory management

The implementation avoids any association with CSpaces and visiting of IObjects. The stub is automatically deleted when the RmiCaller is closed. The skeleton is automatically deleted when the RmiCallee is closed. The client must ensure the receiver object outlives the RmiCallee.

Performance

The implementation is state of the art, as shown by these performance measurements.

Public header files

cxRmi