JMS aka Java Messaging Service and RMI aka Remote Method Invocation, are both used to connect pieces of distriubted application in a Java Enterprise Application, but they follow very different approaches. Here is the difference between JMS and RMI:
- RMI uses synchronous mode of operation, whereas JMS can be configured to work synchronously as well asynchronously.
- When a method call is made via RMI, the caller blocks until the procedure completes. In contrast, message oriented system (JMS) continue processing as soon as the message is dispatched.
- In RMI, when multiple components exist each element of the system has to create an independent connection to each other component, leading to many-to-many mapping between system components. Whereas, in JMS, as all the components in the system communicate via a centralized server the overall architecture is a simpler one-to-many relationship (messaging server to system components).
- Using the synchronous technique RMI leads to more tightly coupled systems and using the asynchronous technique JMS messaging results in loosely coupled systems.
Hope you find the information presented here useful and informative. Please leave your footprints in comments section below for any queries, suggestions or feedback.