This article is intended to explain how JMS is different from RPC. JMS is the acronym of Java Message Service and RPC is the acronym of Remote Procedure Call. Both JMS and RPC are involved in message transmission. However, JMS is different from RPC in the way the messaging is done. The difference between JMS and RPC is explained in the tabular column below:
Java Messaging Service (JMS) | Remote Procedure Call (RPC) |
JMS is asynchronous in nature. When a message has to be transmitted, Sender will send the message to the receiver. With this, Sender’s job is done and it will continue with its further processing. Receiver will receive the message and continue with its own processing. No acknowledgement is sent from the receiver to sender after receiving the message. This is because, JMS is asynchronous. |
RPC is synchronous in nature. Unlike JMS, the invoker of the remote procedure call will invoke the method and continue to wait until the invoked method completes its execution. Once when the invoked method execution is complete, then the control returns back to the invoker. This is because, RPC is synchronous in behaviour. |
There is no coupling between the sender and receiver of the message in JMS. Thus, JMS allows new senders and receivers to be added dynamically thereby managing variations in complexity over a period of time. Hence, JMS is loosely coupled. |
RPC establishes tight coupling between the systems that interact with one another. When the invoker invokes a remote method, the invoker will get blocked until the response comes back to the invoker. |
When there is an unexpected failure, JMS will store the messages that are pending to be delivered. When the system is up, the stored messages will be transmitted to the corresponding receivers. |
When there is an unexpected failure, the failure will impact the entire system. Thereby, the entire system will go down. |