Your Ad Here

Saturday, January 3, 2009

JMS Interview Questions & Answers

Q : What is JMS?
A : The Java Message Service is a Java API that allows applications to create and 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 the programs written in the Java programming language to communicate with the other messaging implementations.

Q : What’s the difference between queue and topic?
A : A topic is typically used for one to many messaging i.e. it supports publish subscribe model of messaging. While queue is used for the one-to-one messaging i.e. it
supports Point to Point Messaging.

Q : What is an encryption options are there for sending messages through JMS?
A : 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 Sonic MQ is a leading the JMS provider and they have a robust encryption mechanism called Quality of Protection. They also provide an SSL-related feature, which is also has build in encryption.

Q :How does the Application server handle the JMS Connection?
• A : Application server is created the server session and stores them in a pool.
• Connection consumer uses the server session to put messages in the session of the JMS.
• Applications written by Application programmers creates the message listener.
• Server session is the one that spawns the JMS session.

Q : What is point-to-point messaging?
A : A point-to-point message passing is the sending application/client establishes a named message queue in the JMS broker/server and sends messages to this queue. The receiving client registers with the broker to receive the messages posted to this queue. There is a one-to-one relationship between the sending and receiving clients.

Q : What is the advantage of persistent message delivery compared to nonpersistent delivery?
A : If the JMS server experiences a failure, for example, a power outage, any message that it is holding in an primary storage potentially could be lost. With persistent storage, the JMS server is 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 the consuming clients.

Q : What is the difference between the Messaging and Mailing?
A: . Messaging is the way of communicating to the remote machines is using the Message Oriented Middlewares. Message Oriented Middlewares don’t use mailing internally for communication. They create their own channels for communication. Java Mailing is the set of APIs that primarily concerns with the sending of Mail messages through the standard mail protocols.

Q : What is a Stream Message ?
A : A Stream messages are a group of java primitives. It contains the some of convenient methods for reading the data. However the Stream Message prevents reading a long value as a short. This is so because the Stream Message also writes the type of information along with the value of the primitive type and enforces a set of strict conversion rules which actually prevents reading of one primitive type as another.

Q : What is the Role of the JMS Provider?
A : The role of the JMS provider is handles the 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.

Q What is the text message?
A : The text messages contains String messages (since being widely used, a separate messaging Type has been supported) . It is useful for exchanging textual data and complex character data like XML.

Q What is an object message ?
A : An Object message contains a group of serializeable java object. So it allows exchange of Java objects between applications. Sot both the applications must be Java applications

Q : What is Map message?
A : A Map message is contain the name of the value Pairs. The values can be of type primitives and its wrappers. The name is a string.

Q What is Byte Message ?
A Byte Messages contains a Stream of uninterrupted bytes. Byte Message contains an array of primitive bytes in it is payload. Thus it can be used for transfer of data between two applications in their native format which may not be compatible with other Message types. It is also to useful the where JMS is used purely as a transport between two systems and the message payload is opaque to the JMS client.

Q : What’s the difference between StreamMessage and BytesMessage?
A :The StreamMessage 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. BytesMessage stores the primitive data types by converting them to their byte representation. Thus the message is one the contiguous stream of bytes BytesMessage allows the data to be read using any type. Thus even if your payload contains a long value, you can invoke a method of 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 StreamMessage. It maintains the type information of the data being stored and enforces strict conversion rules on the data being read.

Q : How JMS is different from RPC?
A : In RPC the method is invoked the waits for the method to finish execution and return to the control back to the invoker. Thus it is completely synchronous in nature. While in the JMS the message sender just sends the message to the destination and continues it is the own processing. The sender does not wait for the receiver to respond. This is asynchronous behavior.

Q : What is main parts of JMS applications?
A :The main parts of JMS applications are:
ConnectionFactory and Destination
Session
Connection
MessageConsumer
MessageProducer
Message

0 comments:

Your Ad Here