JMS(Java Message Service) Interview Questions & Answers

5 avg. rating (100% score) - 1 votes

JMS(Java Message Service) Interview Questions & Answers

JMS is abbreviated as java message service is an application interface that supports formal communication between the computers and networks. It provides a common interface to massage protocols and special messaging service in support of Java programs. There is high demand for JMS experts in the industry today. Steal the opportunity to get placed in the big companies with the help of job interview questions and answers at Wisdomjobs portal. The JMS interview questions and answers serve as a guide to help to gain the knowledge on the various aspects the JMS expert needs to learn to withstand the competition in the industry.You can easily browse through these questions and answers easily with the help of the mobile-friendly website even few minutes before attending the interview.

JMS(Java Message Service) Interview Questions

JMS(Java Message Service) Interview Questions
    1. Question 1. What Is Jms?

      Answer :

      JMS means Java Messaging Service.  It is the new standard for inter client communication. It allows the J2EE application component to create, send, read and receive the messages.

    2. Question 2. What Type Of Messaging Is Provided By Jms?

      Answer :

      JMS provides both type of messaging,

      • synchronous
      • Asynchronous

    3. Question 3. What Do You Mean By Synchronous And Asynchronous Type Of Messaging?

      Answer :

      Synchronous: In this type of messaging, client waits for the server to respond to a message. Ex: Telephone call, two way radio communication.
      Asynchronous: In this type of messaging, client does not wait for a message from the server, but automatically an event is created to trigger a message from a server. Ex: email, text messaging, blog posting.

    4. Question 4. How Many Types Of Messaging Model Do Jms Provide For And What Are They?

      Answer :

      There are two types of messaging models that JMS provides –

      • Point to point queuing
      • Second one is public and subscribe

    5. Question 5. Mention Different Types Of Messages Available In Jms Api?

      Answer :

      The different types of messages available in JMS API are Message, TextMessage, BytesMessage, ObjectMessage and MapMessage.

    6. Question 6. What Is The Difference Between The P2p (peer To Peer) Model And Subscribe Model?

      Answer :

      P2P model is highly reliable and it is used in a one-to-one situation, while subscribe model is used in one-to-many situation. It is very fast but less reliable.

    7. Question 7. What Is A Jms Client?

      Answer :

      JMS client is a language program that sends or receives messages.

    8. Question 8. Can We Send E-mail Messages Using Jms?

      Answer :

      JMS has no inherent support for email operations.

    9. Question 9. Explain How Application Server Handles The Jms Connection?

      Answer :

      •With the help of Application server, the server session is created and it stores them in a pool
      •To put messages in JMS session, connection consumer, uses the Server session
      •Server session is the one that creates the JMS session
      •Application written by Application programmers creates the message listener.

    10. Question 10. What Is The Difference Between Jms And Rpc (remote Procedure Call)?

      Answer :

      The basic difference between JMS and RPC lies in the way they message. JMS uses asynchronous messaging type while, RPC creates synchronous messaging type. The method invoker in RPC, waits for the method to finish execution and return back the control to the invoker. In JMS the message sender just sends the message to the destination and continues its own processing.

    11. Question 11. Explain How Does The Jms Work With The J2ee?

      Answer :

      The application client like enterprise JavaBeans components and web components can send or receive JMS message synchronously. In addition, the application clients can also receive message asynchronously.   With the help of message-driven beans, JMS provider can optionally implement the processing of messages. Message-driven beans are a type of enterprise bean that enables the asynchronous consumption of messages.
      The operation of sending and receiving message is carried out in distributed operation, which allows JMS operations and database accesses within a single transaction.

    12. Question 12. What Are The Types Of Messages That Are Supported By Jms?

      Answer :

      The types of messages that are supported by JMS are
      •Stream Messages
      •Text Messages
      •Map Messages
      •Bytes Messages
      •Object Messages

    13. Question 13. What Is Mom In Reference To Jms?

      Answer :

      The MOM ( Message Oriented Middleware) is a software that works as an intermediate between two communicating components.  It is placed between the client and server, MOM provides the facility of passing message by using the technique queuing. Until the client does not request to read the message, the messages will be stored in queue.  By using this technique, the software component can work independently of time.

    14. Question 14. How You Can Deliver A Java Message To A Non-java Client?

      Answer :

      First of all, after receiving the message from Topic or Queue, the message has to be converted into a non-java client according to their specification. The message once converted to non-java client, it can be delivered.

    15. Question 15. For Sending Messages Through Jms, What Encryption Options Are There?

      Answer :

      The encryption and decryption of the messages is handled by JMS provider and not JMS specifications. Sonic MQ by Progress Software is a leading JMS provider and they do encryption through encryption mechanisms called Quality of Protection.

       

    16. Question 16. For Jms-enabled Application, What Are The Core Jms-related Objects Required?

      Answer :

      The core JMS-related objects that are required are –
      •The connection object
      •One or more sessions within a connection that provides a context for message sending and receiving.
      •A topic or queue object within a session representing the destination within the message broker.
      •Appropriate sender or publisher or receiver within a session.

    17. Question 17. What Is Jms Administered Object?

      Answer :

      JMS administered object is a pre-configured JMS object that is created by an administrator for the use of JMS clients and placed in JNDI namespace.

    18. Question 18. What Is The Important Part Of Jms Applications?

      Answer :

      •Session
      •Connection
      •Message
      •Message Producer
      •Message Consumer
      •Connection factory and destination

    19. Question 19. What Is Jms Session?

      Answer :

      A JMS session is a single-threaded context for sending and receiving JMS messages.  A JMS session could be a locally transacted, non-transacted or distributed transacted.

    20. Question 20. Mention The Difference Between Durable And Non-durable Subscription?

      Answer :

      Durable subscription gives a subscriber the freedom of receiving all messages from a topic, while a non-durable subscription does not make any guarantees about messages sent by others when a client get disconnected by others.

    21. Question 21. What Is Byte Message?

      Answer :

      Byte message is a stream of uninterrupted bytes. It contains an array of primitive bytes in its payload.  For the transfer of data between two applications in their native format, byte message is used, which may be not possible with other message types.

    22. Question 22. Give An Example Of Using Point To Point Model In Jms?

      Answer :

      Example for point to point model, would be a print out. When you select a print-out option, your system sends the message to the server, and once the print-out is taken out, again this server will send the message back to you. Point to point model is used, when the information is specific to a single client.

    23. Question 23. What Is The Role Of The Jms Provider?

      Answer :

      The JMS provider handles data conversion, security of the messages and the client triggering.  It specifies the level of encryption, security level of the message and the best-data type for the non-JMS client.

    24. Question 24. What Are The Components Of Jms?

      Answer :

      •JMS provider
      •JMS client
      •Messages
      •Administered objects
      •Native clients

    25. Question 25. What Is The Jms Api?

      Answer :

      The Java Message Service is a Java API that allows applications to create, send, receive, and read messages. Designed by Sun and several partner companies, the JMS API defines a common set of interfaces and associated semantics that allow programs written in the Java programming language to communicate with other messaging implementations.
      The JMS API minimizes the set of concepts a programmer must learn to use messaging products but provides enough features to support sophisticated messaging applications. It also strives to maximize the portability of JMS applications across JMS providers in the same messaging domain.
      The JMS API enables communication that is not only loosely coupled but also
      Asynchronous. A JMS provider can deliver messages to a client as they arrive; a client does not have to request messages in order to receive them.
      Reliable. The JMS API can ensure that a message is delivered once and only once. Lower levels of reliability are available for applications that can afford to miss messages or to receive duplicate messages.
      The JMS Specification was first published in August 1998. The latest version of the JMS Specification is Version 1.1, which was released in April 2002. You can download a copy of the Specification from the JMS Web site, http://java.sun.com/products/jms/.

    26. Question 26. How Jms Is Different From Rpc?

      Answer :

      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. 

    27. Question 27. How May Messaging Models Do Jms Provide For And What Are They?

      Answer :

      JMS provides for two messaging models, publish-and-subscribe and point-to-point queuing. 

    28. Question 28. What Is The Point-to-point Model In Jms?

      Answer :

      A point-to-point model is based 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-point model, several receivers can exist, attached to the same queue. However, (Message Oriented Middleware)MOM will deliver the message only to one of them. To which depends on the MOM implementation. 

    29. Question 29. What Is The Publish-and-subscribe Model In Jms?

      Answer :

      A publish-subscribe model is based on the message topic concept: Publishers send messages in a topic, and all subscribers of the given topic receive these messages. 

    30. Question 30. What Is Publish/subscribe Messaging?

      Answer :

      With publish/subscribe message passing the sending application/client establishes a named topic in the JMS broker/server and publishes messages to this queue. The receiving clients register (specifically, subscribe) via the broker to messages by topic; every subscriber to a topic receives each message published to that topic. There is a one-to-many relationship between the publishing client and the subscribing clients. 

    31. Question 31. Which Models Are Supported By Jms? Please, Explain Them.

      Answer :

      Publish/subscribe (pub/sub). This model allows a client (publisher) to send messages to a JMS topic. These messages are retrieved by other clients (subscribers) (it may happen so that a topic has no subscribers) asynchronously. Pub/sub model requires a broker distributing messages to different consumers. 

    32. Question 32. What Are The Different Parts Of A Jms Message?

      Answer :

      A JMS message contains three parts. a header, an optional properties and an optional body. 

    33. Question 33. What Is The Main Parts Of Jms Applications?

      Answer :

      The main parts of JMS applications are:

      • ConnectionFactory and Destination
      • Connection
      • Session
      • MessageProducer
      • MessageConsumer
      • Message 

    34. Question 34. What Is The Difference Between Java Mail And Jms Queue?

      Answer :

      JMS is the ideal high-performance messaging platform for intrabusiness messaging, with full programmatic control over quality of service and delivery options.
      JavaMail provides lowest common denominator, slow, but human-readable messaging using infrastructure already available on virtually every computing platform.

    35. Question 35. Does Jms Specification Define Transactions? Queue

      Answer :

      JMS specification defines a transaction mechanisms allowing clients to send and receive groups of logically bounded messages as a single unit of information. A Session may be marked as transacted. It means that all messages sent in a session are considered as parts of a transaction. A set of messages can be committed (commit() method) or rolled back (rollback() method). If a provider supports distributed transactions, it's recommended to use XAResource API. 

       

    36. Question 36. What Is Messaging?

      Answer :

      Messaging is a method of communication between software components or applications. A messaging system is a peer-to-peer facility: A messaging client can send messages to, and receive messages from, any other client. Each client connects to a messaging agent that provides facilities for creating, sending, receiving, and reading messages.
      Messaging enables distributed communication that is loosely coupled. A component sends a message to a destination, and the recipient can retrieve the message from the destination. However, the sender and the receiver do not have to be available at the same time in order to communicate. In fact, the sender does not need to know anything about the receiver; nor does the receiver need to know anything about the sender. The sender and the receiver need to know only what message format and what destination to use. In this respect, messaging differs from tightly coupled technologies, such as Remote Method Invocation (RMI), which require an application to know a remote application's methods.
      Messaging also differs from electronic mail (e-mail), which is a method of communication between people or between software applications and people. Messaging is used for communication between software applications or software components.
      Messaging is a mechanism by which data can be passed from one application to another application. 

    37. Question 37. What Is Synchronous Messaging? Queue

      Answer :

      Synchronous messaging involves a client that waits for the server to respond to a message. So if one end is down the entire communication will fail. 

    38. Question 38. What Is Asynchronous Messaging? Queue

      Answer :

      Asynchronous messaging involves a client that does not wait for a message from the server. An event is used to trigger a message from a server. So even if the client is down , the messaging will complete successfully. 

       

    39. Question 39. How Does A Typical Client Perform The Communication? Queue

      Answer :

      1. Use JNDI to locate administrative objects.
      2. Locate a single ConnectionFactory object.
      3. Locate one or more Destination objects.
      4. Use the ConnectionFactory to create a JMS Connection.
      5. Use the Connection to create one or more Session(s).
      6. Use a Session and the Destinations to create the MessageProducers and MessageConsumers needed.
      7. Perform your communication. 

    40. Question 40. What Is Jms Application?

      Answer :

      One or more JMS clients that exchange messages. 

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JMeter Tutorial