ObjectMQ is a lightweight remote object layer constructed on top of RabbitMQ. The middleware provides three remote invocation abstractions including two one-to-one calls (synchronous, asynchronous) and a one-to-many call (multi).
The one-to-one calls are defined on the client side using Java Annotations. We have the next types:
@SyncMethod: This is a synchronous blocking remote call where the client publishes a message on the target's object request Queue (QRequest), and then blocks for a response on its own client's response queue (QResponse). This call can be configured with a timeout and the number of retries to trigger the exception if the result does not arrive.
@AsyncMethod: This is an asynchronous non-blocking one-way invocation where the client publishes a message on the target's object request Queue (QRequest). By default, the client expects no response and it is not even noticed if the message was handled correctly.
The one-to-many call is also defined on the client side as follows:
ObjectMQ aims to be simple and minimalist so we delegate as much responsibilities as we can to the RabbitMQ broker. In this line, we do not even provide a centralized Naming registry for binding and locating remote objects. Our equivalent omq.broker.Broker interface provides similar bind and lookup methods but instead of storing them on a single server, we just interface with the Message Broker.
How it works:
broker.bind(oid, Server): registers a remote object with an specific identifier "oid". This binding operation implies that "oid = QRequest" for this specific object. The remote object will consume method requests from QRequest. When an object is bound, another queue it's created, this queue will be a unique request queue to serve the multi messages.
broker.lookup(oid, aClass): creates a Proxy object for class aClass that will subscribe to its Response Queue QResponse and will send messages to the server request queue QRequest.
Note that binding more than one server to the same identifier also means that they will balance the load from clients. RabbitMQ already provide automatic load balancing of messages to the different consumers of the same Queue. This helps us to scale the service by adding more servers to handle the load.
ObjectMQ offers a variety of message serializers such as JSON, Kryos and Java Serialization. Using the JSON serialization enables to use any language to invoke any method on the server side.
For more information please visit the following website: http://ast-deim.urv.cat/objectmq