JMS Interview Questions for Experienced/JMS Interview Questions and Answers for Freshers & Experienced

How do I communicate between two clients that are on different machines on a network using JMS? I want to use a standalone application for communicating between the machine and I want to pass the message using JMS.?

You can make two JMS client applications, say AppA and AppB. Make AppA listen to topic ‘forA’. Make AppB listen to topic ‘forB’.
If AppA sends a message to topic ‘forB’, AppB will receive it. If AppB sends a message to topic ‘forA’, AppA will receive it.
For sample code etc, try downloading SonicMQ (as a JMS server) and go through the samples.

Posted Date:- 2021-11-11 10:01:19

Whats is a subtle difference between a "durable" JMS message and a "persistent" JMS message ?

A "durable" JMS message is applicable only to publish/subscribe paradigm and the "persistent" JMS message is applicable to both "Point-to-Point" & "publish/subcribe" paradigms.
Let's look at both:
A " durable message " is a message where the JMS server will hold on to a message if the subscriber is temporarily unavaliable. So the durability is defined by the relationship between a "Topc Subscriber" and the "JMS Server". Durability is applicable only to publish/Subscribe paradigm. For this to happen subscribers need to register themselves with a unique " client id ". A " persistent message " is a message that defines the relationship between a "Message Producer" and the "JMS Server". This can be established for both
point-to-point and publish/subscribe. This has to do with the guaranteed once only delivery of the message by persisting the message after it has been recieved from the message producer.

Posted Date:- 2021-11-11 09:59:36

How to create Transacted session?

To implement the transacted session mode, when creating the receiver's session, specify true as createSession()'s first argument. You ignore the createSession() method's second argument; to clearly denote its lack of use, pass in a dummy value such as -1.
The application indicates successful message processing by invoking the Session class's commit() method. The application can reject a message or a message group by invoking Session class's rollback() method. Calling the commit() method commits all the messages the session receives. Similarly, calling the rollback() method rejects all the messages the session receives. Session's commit() and rollback() methods make sense only with the transacted session option. The transacted session uses a chained-transaction model. In a chained-transaction model, an application does not explicitly start a transaction. Upon calling either the commit() or the rollback() methods, the application automatically starts a new transaction. Because a transaction is not explicitly started, it is always present and available.

Posted Date:- 2021-11-11 09:58:14

What is Client acknowledgement in JMS?

To implement client acknowledgement mode, when you create the receiver's session, specify false as createSession()'s first argument and Session.CLIENT_ACKNOWLEDGE as its second argument. Specifying false creates a nontransacted session. In client mode, invoking the Message class's acknowledge() method explicitly acknowledges the message. In fact, using the acknowledge() method makes sense when only using the client mode.

Posted Date:- 2021-11-11 09:57:27

What are Message delivery stages in JMS?

Toward the end of delivery, the message conceptually passes through the following stages: message with JMS provider and message in application processing.
Message with JMS provider In this stage, the message stays with the JMS provider just before the provider delivers it to the application. Consider a catastrophic situation where the JMS provider fails. What happens to the messages that the provider has not yet delivered to the client? Will the messages be lost?
The messages' fate depends not upon the transaction options outlined earlier, but rather upon the delivery mode. There are two delivery modes:nonpersistent and persistent. Messages with nonpersistent delivery modes are potentially lost if the JMS provider fails. Messages with persistent delivery modes are logged and stored to a stable storage. The JMS provider saves these messages to a stable storage, such as a database or a file system, and eventually delivers them to the application for processing.
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
producer.setTimeToLive(60000);
Message in application processing In this stage, the application receives the message from the JMS provider and processes it. Consider a failure occurring during message processing. What happens to the message? Will the message be lost or redelivered for successful processing later? Theanswers to these questions depend upon the transaction options you choose.

Posted Date:- 2021-11-11 09:56:13

Why doesn't the JMS API provide end-to-end synchronous message delivery and notification of delivery?

Some messaging systems provide synchronous delivery to destinations as a mechanism for implementing reliable applications. Some systems provide clients with various forms of delivery notification so that the clients can detect dropped or ignored messages. This is not the model defined by the JMS API.
JMS API messaging provides guaranteed delivery via the once-and-only-once delivery semantics of PERSISTENT messages. In addition, message consumers can ensure reliable processing of messages by using either CLIENT_ACKNOWLEDGE mode or transacted sessions. This achieves reliable delivery with minimum synchronization and is the enterprise messaging model most vendors and developers prefer.
The JMS API does not define a schema of systems messages (such as delivery notifications). If an application requires acknowledgment of message receipt, it can define an application-level acknowledgment message.

Posted Date:- 2021-11-11 09:55:29

What is the advantage of persistent message delivery compared to nonpersistent delivery?

If the JMS server experiences a failure, for example, a power outage, any message that it is holding in primary storage potentially could be lost. With persistent storage, the JMS server logs every message to secondary storage. (The logging occurs on the front end, that is, as part of handling the send operation from the message producing client.) The logged message is removed from secondary storage only after it has been successfully delivered to all consuming clients .

Posted Date:- 2021-11-11 09:54:36

Can two different JMS services talk to each other? For instance, if A and B are two different JMS providers, can Provider A send messages directly to Provider B? If not, then can a subscriber to Provider A act as a publisher to Provider B?

The answers are no to the first question and yes to the second. The JMS specification does not require that one JMS provider be able to send messages directly to another provider. However, the specification does require that a JMS client must be able to accept a message created by a different JMS provider, so a message received by a subscriber to Provider A can then be published to Provider B. One caveat is that the publisher to Provider B is not required to handle a JMSReplyTo header that refers to a destination that is specific to Provider A.

Posted Date:- 2021-11-11 09:53:07

What is the use of ObjectMessage?

ObjectMessage contains a Serializable java object as it's payload. Thus it allows exchange of Java objects between applications. This in itself mandates that both the applications be Java applications. The consumer of the message must typecast the object received to it's appropriate type. Thus the consumer should before hand know the actual type of the object sent by the sender. Wrong type casting would result in ClassCastException. Moreover the class definition of the object set in the payload should be available on both the machine, the sender as well as the consumer. If the class definition is not available in the consumer machine, an attempt to type cast would result in ClassNotFoundException. Some of the MOMs might support dynamic loading of the desired class over the network, but the JMS specification does not mandate this behavior and would be a value added service if provided by your vendor. And relying on any such vendor specific functionality would hamper the portability of your application. Most of the time the class need to be put in the classpath of both, the sender and the consumer, manually by the developer.

Posted Date:- 2021-11-11 09:29:23

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.

Posted Date:- 2021-11-11 09:28:24

Are you aware of any major JMS products available in the market?

IBM's MQ Series is one of the most popular product used as Message Oriented Middleware. Some of the other products are SonicMQ, iBus etc.All the J2EE compliant application servers come built with thier own implementation of JMS.

Posted Date:- 2021-11-11 09:27:50

For sending messages through JMS, what encryption options are there?

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.

Posted Date:- 2021-11-11 09:25:55

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 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.

Posted Date:- 2021-11-11 09:25:00

Explain the difference between topic and queue?

Queue technique is used for one to one messaging, and it supports point to point messaging. While topic is typically used for one to many messaging and it supports public subscribe model of messaging.

Posted Date:- 2021-11-11 09:23:21

How does the Application server handle the JMS Connection?

* Application server creates the server session and stores them in a pool.
* Connection consumer uses the server session to put messages in the session of the JMS.
* Server session is the one that spawns the JMS session.
* Applications written by Application programmers creates the message listener.

Posted Date:- 2021-11-11 09:22:22

What encryption options are there for sending messages through JMS?

Encryption is not handled by the JMS specification. It is left to the JMS provider to implement and provide encryption and decryption of messages. These days, Progress Software’s SonicMQ is a leading JMS provider and they have a robust encryption mechanism called Quality of Protection. They also provide an SSL-related feature, which also has build in encryption.

Posted Date:- 2021-11-11 09:21:28

Is it possible to acknowledge individual messages on a queue without affecting previously received, but as yet unacknowledged, messages?

If you acknowledge a message, all previously received messages will also be acknowledged. From the javax.jms.Message Javadoc, the acknowledge method will “Acknowledge this and all previous messages received.”

So the answer to your question is no, if what you meant by “affecting” is not-yet acknowledged.

I suggest an alternative. You should look at javax.jms.QueueBrowser to review queued messages. QueueBrowser has getEnumeration, which “Gets an enumeration for browsing the current queue messages in the order they would be received”.

Posted Date:- 2021-11-11 09:20:47

How do I communicate between two clients that are on different machines on a network using JMS? I want to use a standalone application for communicating between the machine and I want to pass the message using JMS.

You can make two JMS client applications, say AppA and AppB. Make AppA listen to topic ‘forA’. Make AppB listen to topic ‘forB’.

If AppA sends a message to topic ‘forB’, AppB will receive it. If AppB sends a message to topic ‘forA’, AppA will receive it.

Posted Date:- 2021-11-11 09:18:47

Does Tomcat support JMS (Java Messaging Service)?

Tomcat is just a servlet container, not an EJB container nor an application server, so it does not contains any JMS basic support. However, there’s nothing stopping you from using another JMS provider.

Posted Date:- 2021-11-11 09:18:11

Give an example of using the point-to-point model.

The point-to-point model is used when the information is specific to a single client. For example, a client can send a message for a print out, and the server can send information back to this client after completion of the print job.

Posted Date:- 2021-11-11 09:17:48

How does a typical client perform the communication?

* Use JNDI to locate administrative objects.

* Locate a single ConnectionFactory object.

* Locate one or more Destination objects.

* 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 needed.

* Perform your communication.

Posted Date:- 2021-11-11 09:17:21

What is the Role of the JMS Provider?

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

Posted Date:- 2021-11-11 09:16:10

What are the core JMS-related objects required for each JMS-enabled application?

Each JMS-enabled client must establish the following:

>> A connection object provided by the JMS server (the message broker).

>> Within a connection, one or more sessions, which provide a context for message sending and receiving.

>> Within a session, either a queue or topic object representing the destination (the message staging area) within the message broker.

>> Within a session, the appropriate sender or publisher or receiver or subscriber object (depending on whether the client is a message producer or consumer and uses a point-to-point or publish/subscribe strategy, respectively). Within a session, a message object (to send or to receive).

Posted Date:- 2021-11-11 09:15:10

Why doesn’t the JMS API provide end-to-end synchronous message delivery and notification of delivery?

Some messaging systems provide synchronous delivery to destinations as a mechanism for implementing reliable applications. Some systems provide clients with various forms of delivery notification so that the clients can detect dropped or ignored messages. This is not the model defined by the JMS API. JMS API messaging provides guaranteed delivery via the once-and-only-once delivery semantics of PERSISTENT messages. In addition, message consumers can insure reliable processing of messages by using either CLIENT_ACKNOWLEDGE mode or transacted sessions. This achieves reliable delivery with minimum synchronization and is the enterprise messaging model most vendors and developers prefer. The JMS API does not define a schema of systems messages (such as delivery notifications). If an application requires acknowledgment of message receipt, it can define an application-level acknowledgment message.

Posted Date:- 2021-11-11 09:13:54

How does the Application server handle the JMS Connection?

* App server creates the server session and stores them in a pool.
* Connection consumer uses the server session to put messages in the session of the JMS.
* Server session is the one that spawns the JMS session.
* Applications written by Application programmers creates the message listener.

Posted Date:- 2021-11-11 09:13:18

What is the role of JMS in enterprise solution development?

JMS is typically used in the following scenarios
1. Enterprise Application Integration: – Where a legacy application is integrated with a new application via messaging.
2. B2B or Business to Business: – Businesses can interact with each other via messaging because JMS allows organizations to cooperate without tightly coupling their business systems.
3. Geographically dispersed units: – JMS can ensure safe exchange of data amongst the geographically dispersed units of an organization.
4. One to many applications: – The applications that need to push data in packet to huge number of clients in a one-to-many fashion are good candidates for the use JMS. Typical such applications are Auction Sites, Stock Quote Services etc.

Posted Date:- 2021-11-11 08:05:12

Why doesn’t the JMS API provide end-to-end synchronous message delivery and notification of delivery?

Some messaging systems provide synchronous delivery to destinations as a mechanism for implementing reliable applications. Some systems provide clients with various forms of delivery notification so that the clients can detect dropped or ignored messages. This is not the model defined by the JMS API. JMS API messaging provides guaranteed delivery via the once-and-only-once delivery semantics of PERSISTENT messages. In addition, message consumers can insure reliable processing of messages by using either CLIENT_ACKNOWLEDGE mode or transacted sessions. This achieves reliable delivery with minimum synchronization and is the enterprise messaging model most vendors and developers prefer. The JMS API does not define a schema of systems messages (such as delivery notifications). If an application requires acknowledgment of message receipt, it can define an application-level acknowledgment message.

Posted Date:- 2021-11-11 08:04:37

What are the core JMS-related objects required for each JMS-enabled application?

Each JMS-enabled client must establish the following:

A connection object provided by the JMS server (the message broker)
Within a connection, one or more sessions, which provide a context for message sending and receiving
Within a session, either a queue or topic object representing the destination (the message staging area) within the message broker
Within a session, the appropriate sender or publisher or receiver or subscriber object (depending on whether the client is a message producer or consumer and uses a point-to-point or publish/subscribe strategy, respectively). Within a session, a message object (to send or to receive)

Posted Date:- 2021-11-11 07:59:39

Where JMS is used in the e-commerce application?

JMS can be used for e-commerce applications along with XML. The JMS middleware has the functionality to ease the communication process between the e-commerce systems. The marketing companies of the e-commerce sector can share information regularly. This data can be used and shared among other departments of the company.

Posted Date:- 2021-11-11 07:59:05

How to send data in the file to JMS queue in tibco bw?

The steps to send data in the file to JMS queue in tibco.bw are as follows:

* Create a JMS server and modify the parameters like server type, IP address, and server name.
* Add a transfer definition and modify the parameters like description, server and client file name, server name, protocols used etc.
* Configure the JMS properties and additional transfer properties.
* Click Add after the modifications are over.

Posted Date:- 2021-11-11 07:58:05

How to ping JMS connection?

The asadmin> JMS-ping command can be used to ping or check whether a JMS connection is running.

Posted Date:- 2021-11-11 07:57:06

What is the use of JMS file store?

The JMS file store is used to store and page messages. This store can be a database that can be accessed through JDBC or file store based on a disk. The exact location of these messages can be obtained by checking the config directory in a WebLogic server.

Posted Date:- 2021-11-11 07:56:06

How JMS works in WebSphere?

In case of JMS, the applications being executed in an application server are connected to a message engine by the help of a WebSphere Application server. WebSphere is used to modify the settings of JMS resources for several applications.

Posted Date:- 2021-11-11 07:55:42

Explain request-response message exchange pattern.

You can use request-reply messaging with Guaranteed Messages when you require a response to each published message from the consuming client that receives those messages. A request-reply messaging model differs from a traditional pub/sub or P2P model, where a message is published to a Topic or Queue and a client can consume the message without providing a reply message in response to the publisher.

Posted Date:- 2021-11-11 07:54:58

What is Message demotion?

Message demotion is the situation where the producer sends Persistent messages, and there are consumers that want to receive these messages but can tolerate lost messages. These consumers can add a topic subscription matching these messages, and receive them in real-time as Direct messages.

The producer application is sending mission-critical data, but some consumers of this data are not mission-critical, and should never be allowed to affect the publishers.

Posted Date:- 2021-11-11 07:54:29

Explain Message promotion in Solace Message delivery mode.

Message promotion refers to a situation where producer sends DIRECT messages however consumer receives it from a guaranteed message endpoint. These messages are non-persistent where the publisher is never back pressured, consumers, receive the data in the most fault-tolerant(persistent) way.

In this scenario, the consumers receive events using a QUEUE endpoint with mapped topics (or topic subscription). The consumer application will NEVER miss any message even if it's slow/offline, the messages will accumulate in the queue endpoint.

Posted Date:- 2021-11-11 07:54:06

Can I deliver a Java message to a non-java client?

Yes. After the message is received from Topic or Queue, the message may be converted into a non-java client according to its specification and delivered.

Posted Date:- 2021-11-11 07:49:38

Explain how JMS works with the J2EE?

The enterprise JavaBeans components and web components can send or receive JMS message asynchronously. In addition, the application clients can also receive message asynchronously. Using 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 performed as distributed operation, which allows JMS operations and database accesses within a single transaction.

Posted Date:- 2021-11-11 07:48:59

What is the difference between Byte Message and Stream Message?

Bytes Message stores data in bytes. Thus the message is one contiguous stream of bytes. While the Stream Message maintains a boundary between the different data types stored because it also stores the type information along with the value of the primitive being stored. Bytes Message allows data to be read using any type. Thus even if your payload contains a long value, you can invoke a method to read a short and it will return you something. It will not give you a semantically correct data but the call will succeed in reading the first two bytes of data. This is strictly prohibited in the Stream Message. It maintains the type information of the data being stored and enforces strict conversion rules on the data being read.

Posted Date:- 2021-11-11 07:47:09

Name some of the other major JMS products available in the market.

IBM's MQ Series is one of the most popular product used as Message Oriented Middleware. Some of the other products include SonicMQ, iBus etc.

All the J2EE compliant application servers come with its own implementation of JMS.

Posted Date:- 2021-11-11 07:45:21

Difference between topic and queue in JMS.

Queuing is used for one to one messaging and it supports point to point messaging model while topic is typically used for one to many messaging and it supports public subscribe model of messaging.

Posted Date:- 2021-11-11 07:44:43

Difference between Point to Point and Publish/Subscribe models in JMS.

In point to point communication (one producer and one consumer), the producers and consumers of the message are defined. The producers push the messages in the queues and the receivers retrieve them. It is highly reliable.

In publish and subscribe method (one producer and one or more consumer), the producers publish the message and the subscribers who have subscribed to that topic receive them. In this way, a message may be received, or processed, by multiple consumers. It is unreliable however very fast.

Posted Date:- 2021-11-11 07:44:27

What are the advantages of JMS?

Asynchronous messaging.

Reliability. Ensures once and only once message delivery.

Loose coupling. JMS can be used in heterogeneous environments with decoupled systems that can communicate over system boundaries.

Posted Date:- 2021-11-11 07:43:34

Which JMS Provider have you worked with? Like IBM's WMQ, Apache Active MQ, Sonic MQ, etc

This messaging question is normally asked at the start of the interview, to get an idea of whether you have practical experience in JMS or not. If you have used JMS then, it must be via a JMS provider like Websphere MQ from IBM or Tibco EMS. You can answer this question based upon your experience with a particular JMS Provider.

Posted Date:- 2021-11-11 07:40:39

Suppose your application is communicating with another application using JMS and sending and receiving XML messages. What will you do to improve performance?

Well, large XML messages really consume a lot of bandwidth, when they are transferred from client to broker (JMS Provider) and further from broker to recipient. You can reduce this bandwidth by compressing messages before sending it on the client-side.

Since XML messages compress a lot, it's worth doing at the client-side with the expense of some CPU time. Java even provides a compression facility in form of java.util.zip package. But remember that compression and decompression on both the sender and receiver side must use the same algorithm.

Also, If you are using the PERSISTENT delivery mode, then messages are persisted on the server-side, before delivering to consumers, compressed messages take less time and space on the server-side during persistence.

Posted Date:- 2021-11-11 07:40:23

What is JMS Selector? How does it work? Any example of Using JMS Selector?

JMS Selector is a filtering facility provided by JMS Provider or broker. Suppose a client is only interested in listening to some specific messages and not all traffic from Server than it can either filter messages upon receiving, or it can use JMS selector to do the filtering on Broker itself. JMS Selector allows you to specify filtering criteria in the form of String, which is a subset of SQL conditional expression.

For example, if you are interested in messages which are for stocks starts with A, you can specific condition as SYMBOL like "A%", where SYMBOL is a user-defined Message property set by Sender.

Since JMS Selector can not select messages based upon the content of the message body, it's the sender's responsibility to populate an agreed Message Property for each message. Since selection is done on the broker side, a JMS selector is provided to the broker by the consumer while subscribing to a topic or listening to Queue.

After that, this consumer will only receive the message which passes the condition specified as part of the JMS selector string. JMS Selector can be a handy feature to implement load balancing, for example, you can create multiple instances of your application, each listening on a subset of stocks, specified by JMS Selector.

Posted Date:- 2021-11-11 07:40:04

Does JMS Session object is thread-safe? Can we share JMS Session among multiple threads?

A Session object in JMS is a single-threaded context for creating message producers and consumers. It's not thread-safe, and not advised to share among multiple threads.

Posted Date:- 2021-11-11 07:39:45

Explain Asynchronous messaging in JMS.

In asynchronous messaging, client does not wait for a message from the server, instead it automatically creates an event to trigger when response received from server. For example, email and text messaging.

Posted Date:- 2021-11-11 07:39:17

Explain Synchronous messaging in JMS.

In synchronous messaging, client waits for the server to respond to a message before it continue its own processing.

Posted Date:- 2021-11-11 07:38:55

How JMS (Java messaging service) is different from RPC (Remote Procedure call)?

JMS provides asynchronous messaging while RPC is synchronous.

In RPC the client who invokes the method need to wait for the method to complete the execution and return the control back to the invoker due to its synchronous nature. In JMS the message sender just sends the message to the destination and continues its own processing. The sender does not need to wait for the receiver to respond as JMS is asynchronous.

Posted Date:- 2021-11-11 07:38:37

Search
R4R Team
R4R provides JMS Freshers questions and answers (JMS Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,JMS Interview Questions for Experienced,JMS Freshers & Experienced Interview Questions and Answers,JMS Objetive choice questions and answers,JMS Multiple choice questions and answers,JMS objective, JMS questions , JMS answers,JMS MCQs questions and answers R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for JMS fresher interview questions ,JMS Experienced interview questions,JMS fresher interview questions and answers ,JMS Experienced interview questions and answers,tricky JMS queries for interview pdf,complex JMS for practice with answers,JMS for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .