DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Preventing Data Loss With Kafka Listeners in Spring Boot
  • What Are Events? API Calls
  • ActiveMQ JMS (Java Messaging Service) vs. Data Streaming Kafka With Camel Code Sample
  • HTTP vs Messaging for Microservices Communications

Trending

  • What Is Good Database Design?
  • How to Submit a Post to DZone
  • DZone's Article Submission Guidelines
  • Demystifying Project Loom: A Guide to Lightweight Threads in Java
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. RMI vs. JMS Clarification

RMI vs. JMS Clarification

Having trouble choosing between RMI and JMS? Take a look at the pros and cons of each in this article.

Dinuka Malalanayake user avatar by
Dinuka Malalanayake
·
May. 23, 16 · Opinion
Like (7)
Save
Tweet
Share
9.85K Views

Join the DZone community and get the full member experience.

Join For Free

Most developers and system designers may know what RMI is and what JMS is, but when they come to develop or design a real world application, they have trouble with which one to choose. So I thought it would be good to publish some thoughts on this.

Let's start with the regular descriptions.

RMI – Remote Method Invocation

rmi-5

  1. Synchronous communication – Request initiator waits for the response. In order to archive this, the RMI service needs to be up at the time of communication.
  2. Tightly coupled – Requesting system is coupled to the declared interface in RMI service.
  3. Unreliable communication – If something happens in-between the communication you will lose the request and have to handle those in application level.

Advantages:
Easy to start by writing a simple interface and the implementation.

Disadvantages:
Can use only the Java-supported platforms.
Cannot use the code out of the scope of Java.
Security issues need to be monitored more closely.

Using RMI:
If you have a process with heavy computation and need more computation power to improve the performance, then you can go with RMI because it will give you the computation power on simple method calls.

JMS – Java Message Service

Topic – Publish and subscribe model

publish_subscribe
Queue – Load balancing model

qs-multiple-consumers

  1. Asynchronous communication – Request initiator is not going to wait for the response and it just sends the message out then close the connection. No need to have backing service up at the time of communication.
  2. Loosely coupled – It is not tightly coupled with the service like RMI. You can use any kind of data format to communicate via message QUEUEs and TOPICs. e.g. XML, JSON
  3. Reliable communication – This is not like RMI because this communication has a message broker in-between the systems, and the message broker has the capability of error handling and the persistence of the messages and hands them to the responsible party.

Advantages:
Due to asynchronous messaging, all the modules don’t need to be up for the application to function as a whole.

Disadvantages:
Extra overhead on setup and maintenance of the message broker

Using JMS:
If you have any process that will be getting a heavy request load and that can be run asynchronously, then go for JMS Queue implementations and run them separately and communicate via the queue. The next point is if you have a process that needs to send data to many downstream applications, then go for JMS Topic implementation.

By the way, remember this: There is no such a thing as bad technology, only bad choices.

Message broker

Published at DZone with permission of Dinuka Malalanayake. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Preventing Data Loss With Kafka Listeners in Spring Boot
  • What Are Events? API Calls
  • ActiveMQ JMS (Java Messaging Service) vs. Data Streaming Kafka With Camel Code Sample
  • HTTP vs Messaging for Microservices Communications

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: