Java Message Service (JMS) Interview Preparation Guide
Download PDF
Add New Question

JMS Interview Questions and Answers will guide us that Java Message Service (JMS) API is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients. JMS is a part of the Java Platform, Enterprise Edition, and is defined by a specification developed under the Java Community Process as JSR 914. So learn more about JMS by the help of this JMS Interview Questions with Answers guide

17 JMS Questions and Answers:

1 :: What is JMS (Java Messaging Service)?

JMS is an acronym used for Java Messaging Service. It is Java's answer to creating software using asynchronous messaging. It is one of the official specifications of the J2EE technologies and is a key technology.
Post Your Answer

2 :: How the JMS is different from RPC?

In RPC the method invoker waits for the method to finish execution and return the control back to the invoker. Thus it is completely synchronous in nature. While in JMS the message sender just sends the message to the destination and continues it's own processing. The sender does not wait for the receiver to respond. This is asynchronous behavior.
Post Your Answer

3 :: What are the basic advantages of JMS?

JMS is asynchronous in nature. Thus not all the pieces need to be up all the time for the application to function as a whole. Even if the receiver is down the MOM will store the messages on it's behalf and will send them once it comes back up. Thus at least a part of application can still function as there is no blocking.
Post Your Answer

4 :: What are the different types of messages available in the JMS API?

Message, TextMessage, BytesMessage, StreamMessage, ObjectMessage, MapMessage are the different messages available in the JMS API.
Post Your Answer

5 :: What are the different messaging paradigms JMS supports?

Publish and Subscribe i.e. pub/suc and Point to Point i.e. p2p.
Post Your Answer

6 :: What is the difference between topic and queue?

A topic is typically used for one to many messaging i.e. it supports publish subscribe model of messaging. While queue is used for one-to-one messaging i.e. it supports Point to Point Messaging.
Post Your Answer

7 :: What is the use of Message object?

Message is a light weight message having only header and properties and no payload. Thus if theIf the receivers are to be notified abt an event, and no data needs to be exchanged then using Message can be very efficient.
Post Your Answer

8 :: What is the basic difference between Publish Subscribe model and P2P model?

Publish Subscribe model is typically used in one-to-many situation. It is unreliable but very fast. P2P model is used in one-to-one situation. It is highly reliable.
Post Your Answer

9 :: What is the use of TextMessage?

TextMessage contains instance of java.lang.String as it's payload. Thus it is very useful for exchanging textual data. It can also be used for exchanging complex character data such as an XML document.
Post Your Answer

10 :: What is the use of MapMessage?

A MapMessage carries name-value pair as it's payload. Thus it's payload is similar to the java.util.Properties object of Java. The values can be Java primitives or their wrappers
Post Your Answer
Add New Question