Top 40 Java Message Service (JMS) Interview Questions
Q1. Does Jms Specification Define Tractions? Queue
JMS specification defines a traction mechanisms allowing customers to ship and acquire corporations of logically bounded messages as a single unit of records. A Session can be marked as tracted. It me that all messages sent in a consultation are considered as parts of a traction. A set of messages can be devoted (dedicate() method) or rolled returned (rollback() method). If a company supports allotted tractions, it is encouraged to use XAResource API.
Q2. Give An Example Of Using Point To Point Model In Jms?
Example for factor to factor model, could be a print out. When you select a print-out option, your system sends the message to the server, and as soon as the print-out is taken out, once more this server will ship the message lower back to you. Point to point model is used, while the statistics is unique to a single purchaser.
Q3. What Is Publish/subscribe Messaging?
With publish/subscribe message passing the sending utility/patron establishes a named subject matter in the JMS dealer/server and publishes messages to this queue. The receiving clients sign in (specifically, subscribe) through the dealer to messages with the aid of topic; each subscriber to a subject receives each message posted to that subject matter. There is a one-to-many dating between the publishing client and the subscribing clients.
Q4. What Is Messaging?
Messaging is a technique of communique among software program additives or programs. A messaging machine is a peer-to-peer facility: A messaging customer can send messages to, and get hold of messages from, any other patron. Each customer connects to a messaging agent that gives facilities for developing, sending, receiving, and studying messages.
Messaging permits allotted communication this is loosely coupled. A issue sends a message to a vacation spot, and the recipient can retrieve the message from the destination. However, the sender and the receiver do now not ought to be to be had at the equal time for you to speak. In fact, the sender does no longer need to know something approximately the receiver; nor does the receiver want to understand some thing about the sender. The sender and the receiver need to understand simplest what message layout and what vacation spot to apply. In this appreciate, messaging differs from tightly coupled technologies, which include Remote Method Invocation (RMI), which require an software to understand a far flung utility's strategies.
Messaging also differs from e mail (electronic mail), which is a technique of communication among people or among software applications and those. Messaging is used for verbal exchange between software applications or software components.
Messaging is a mechanism through which facts may be handed from one software to another utility.
Q5. For Jms-enabled Application, What Are The Core Jms-related Objects Required?
The middle JMS-related gadgets which can be required are –
•The connection item
•One or extra sessions within a connection that offers a context for message sending and receiving.
•A topic or queue object inside a consultation representing the destination inside the message dealer.
•Appropriate sender or publisher or receiver within a consultation.
Q6. What Is Jms Administered Object?
JMS administered object is a pre-configured JMS object that is created by using an administrator for the usage of JMS customers and positioned in JNDI namespace.
Q7. What Is Jms?
JMS me Java Messaging Service. It is the new general for inter purchaser conversation. It allows the J2EE software factor to create, ship, study and acquire the messages.
Q8. Which Models Are Supported By Jms? Please, Explain Them.
Publish/subscribe (pub/sub). This version permits a patron (publisher) to send messages to a JMS topic. These messages are retrieved by means of different customers (subscribers) (it could take place in order that a subject has no subscribers) asynchronously. Pub/sub version calls for a broker distributing messages to one of a kind purchasers.
Q9. What Is The Publish-and-subscribe Model In Jms?
A submit-subscribe version is based at the message subject matter idea: Publishers ship messages in a subject, and all subscribers of the given topic acquire those messages.
Q10. What Is A Jms Client?
JMS client is a language software that sends or gets messages.
Q11. How Jms Is Different From Rpc?
In RPC the technique invoker waits for the technique to finish execution and return the manipulate returned to the invoker. Thus it's far 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 now not await the receiver to respond. This is asynchronous behavior.
Q12. How Does A Typical Client Perform The Communication? Queue
@Use JNDI to locate administrative items.
@Locate a single ConnectionFactory item.
@Locate one or extra Destination gadgets.
@Use the ConnectionFactory to create a JMS Connection.
@Use the Connection to create one or more Session(s).
@Use a Session and the Destinations to create the MessageProducers and MessageConsumers wanted.
@Perform your communique.
Q13. What Is The Jms Api?
The Java Message Service is a Java API that permits programs to create, send, acquire, and examine messages. Designed by means of Sun and numerous companion corporations, the JMS API defines a not unusual set of interfaces and associated semantics that permit applications written in the Java programming language to speak with other messaging implementations.
The JMS API minimizes the set of principles a programmer need to learn how to use messaging products however presents sufficient features to guide state-of-the-art messaging applications. It additionally strives to maximize the portability of JMS applications across JMS providers in the equal messaging area.
The JMS API allows conversation that isn't best loosely coupled but also
Asynchronous. A JMS provider can deliver messages to a customer as they arrive; a purchaser does not ought to request messages on the way to get hold of them.
Reliable. The JMS API can ensure that a message is delivered as soon as and handiest as soon as. Lower ranges of reliability are to be had for programs which can come up with the money for to miss messages or to obtain duplicate messages.
The JMS Specification was first published in August 199@The modern-day model of the JMS Specification is Version 1.1, which changed into released in April 20@You can download a copy of the Specification from the JMS Web web site, http://java.Solar.Com/products/jms/.
Q14. What Is The Important Part Of Jms Applications?
•Session
•Connection
•Message
•Message Producer
•Message Consumer
•Connection factory and destination
Q15. What Do You Mean By Synchronous And Asynchronous Type Of Messaging?
Synchronous: In this kind of messaging, patron waits for the server to respond to a message. Ex: Telephone name, two manner radio verbal exchange.
Asynchronous: In this form of messaging, client does now not await a message from the server, however automatically an occasion is created to cause a message from a server. Ex: e-mail, text messaging, blog posting.
Q16. What Is Asynchronous Messaging? Queue
Asynchronous messaging includes a customer that does not look ahead to a message from the server. An occasion is used to trigger a message from a server. So despite the fact that the consumer is down , the messaging will entire correctly.
Q17. What Are The Components Of Jms?
•JMS company
•JMS consumer
•Messages
•Administered items
•Native customers
Q18. Mention The Difference Between Durable And Non-durable Subscription?
Durable subscription offers a subscriber the liberty of receiving all messages from a topic, whilst a non-long lasting subscription does now not make any guarantees approximately messages sent by others whilst a consumer get disconnected through others.
Q19. What Are The Different Parts Of A Jms Message?
A JMS message contains 3 components. A header, an non-obligatory houses and an optionally available body.
Q20. Mention Different Types Of Messages Available In Jms Api?
The specific varieties of messages to be had in JMS API are Message, TextMessage, BytesMessage, ObjectMessage and MapMessage.
Q21. What Is The Role Of The Jms Provider?
The JMS provider handles data conversion, protection of the messages and the patron triggering. It specifies the extent of encryption, protection degree of the message and the nice-information kind for the non-JMS customer.
Q22. Explain How Does The Jms Work With The J2ee?
The application consumer like enterprise JavaBe additives and net additives can send or acquire JMS message synchronously. In addition, the application clients also can receive message asynchronously. With the assist of message-driven be, JMS company can optionally enforce the processing of messages. Message-pushed be are a type of enterprise bean that permits the asynchronous intake of messages.
The operation of sending and receiving message is finished in disbursed operation, which permits JMS operations and database accesses inside a single traction.
Q23. What Is Mom In Reference To Jms?
The MOM ( Message Oriented Middleware) is a software that works as an intermediate among two communicating additives. It is positioned between the consumer and server, MOM provides the power of passing message by way of the use of the method queuing. Until the patron does not request to examine the message, the messages could be saved in queue. By using this approach, the software program component can work independently of time.
Q24. What Is The Point-to-factor Model In Jms?
A point-to-factor version is based totally on the concept of a message queue: Senders send messages into the queue, and the receiver reads messages from this queue. In the point-to-factor version, numerous receivers can exist, connected to the identical queue. However, (Message Oriented Middleware)MOM will deliver the message handiest to one in every of them. To which relies upon at the MOM implementation.
Q25. What Type Of Messaging Is Provided By Jms?
JMS affords each kind of messaging,
synchronous
Asynchronous
Q26. What Is Jms Session?
A JMS consultation is a unmarried-threaded context for sending and receiving JMS messages. A JMS session will be a regionally tracted, non-tracted or disbursed tracted.
Q27. What Is The Difference Between Java Mail And Jms Queue?
JMS is the ideal excessive-performance messaging platform for intrabusiness messaging, with complete programmatic manage over first-class of service and transport alternatives.
JavaMail affords lowest not unusual denominator, sluggish, but human-readable messaging using infrastructure already to be had on virtually every computing platform.
Q28. For Sending Messages Through Jms, What Encryption Options Are There?
The encryption and decryption of the messages is handled by using JMS company and not JMS specifications. Sonic MQ by Progress Software is a main JMS issuer and they do encryption through encryption mechanisms called Quality of Protection.
Q29. What Is The Difference Between Jms And Rpc (faraway Procedure Call)?
The simple distinction among JMS and RPC lies inside the manner they message. JMS uses asynchronous messaging kind whilst, RPC creates synchronous messaging kind. The technique invoker in RPC, waits for the method to complete execution and return again the manage to the invoker. In JMS the message sender just sends the message to the vacation spot and keeps its personal processing.
Q30. How Many Types Of Messaging Model Do Jms Provide For And What Are They?
There are kinds of messaging models that JMS provides –
Point to point queuing
Second one is public and subscribe
Q31. What Is The Main Parts Of Jms Applications?
The essential components of JMS packages are:
ConnectionFactory and Destination
Connection
Session
MessageProducer
MessageConsumer
Message
Q32. Explain How Application Server Handles The Jms Connection?
•With the assist of Application server, the server session is created and it stores them in a pool
•To positioned messages in JMS consultation, connection purchaser, makes use of the Server session
•Server consultation is the one that creates the JMS session
•Application written via Application programmers creates the message listener.
Q33. What Is Byte Message?
Byte message is a circulate of uninterrupted bytes. It includes an array of primitive bytes in its payload. For the trfer of information among two packages of their local format, byte message is used, which can be not viable with different message sorts.
Q34. What Is Jms Application?
One or more JMS clients that change messages.
Q35. What Is Synchronous Messaging? Queue
Synchronous messaging entails a patron that waits for the server to reply to a message. So if one give up is down the entire verbal exchange will fail.
Q36. Can We Send E-mail Messages Using Jms?
JMS has no inherent help for e mail operations.
Q37. How You Can Deliver A Java Message To A Non-java Client?
First of all, after receiving the message from Topic or Queue, the message must be transformed into a non-java patron according to their specification. The message as soon as transformed to non-java consumer, it could be brought.
Q38. How May Messaging Models Do Jms Provide For And What Are They?
JMS offers for 2 messaging models, post-and-subscribe and point-to-point queuing.
Q39. What Are The Types Of Messages That Are Supported By Jms?
The styles of messages which can be supported by using JMS are
•Stream Messages
•Text Messages
•Map Messages
•Bytes Messages
•Object Messages
Q40. What Is The Difference Between The P2p (peer To Peer) Model And Subscribe Model?
P2P model is fantastically reliable and it's miles utilized in a one-to-one scenario, while subscribe version is utilized in one-to-many state of affairs. It is very rapid however less reliable.

