A durable subscription is created by the subscriber to ensure that it receives all the messages published by the publisher, even during the period when the Receiver is inactive or down. JMS Provider or Broker will retain all messages published by a publisher for a durable subscriber until messages get acknowledge or expired.
Each durable subscriber is known by a unique name (Client id) and JMS Provider keeps a record of all these durable subscriptions to ensure message delivery, even if they are not active.
Posted Date:- 2021-11-11 07:35:35
JMSRedelivered property from Message header can be used by JMS provider to indicate redelivery of a Message. Some JMS Providers also use, properties like delivery Count to indicate the number of times a message is delivered if the delivery Count is more than 1 than it can be used to identify if messages have been redelivered or not. Having said that, it may possible that different JMS providers to indicate delivery count.
Posted Date:- 2021-11-11 07:34:28
This is a follow-up of the previous JMS Interview Question. No, you don't need to acknowledge the message explicitly by calling the acknowledge() method if you are using a transacted JMS Session. As I said above, commit() and rollback() is used for acknowledging messages.
By the way, if you are using Spring JMS facilities such as AbstractMessageListenerContainer or DefaultMessageListenerContainer and have their sessionTransacted property as true, then every successful onMessage() execution will acknowledge the message and guaranteed redelivery in case of exception thrown.
Posted Date:- 2021-11-11 07:33:17
If JMS Session is transacted, in which case it returns SESSION_TRANSACTED from getAcknowledgeMode(), acknowledgment mode is ignored.
In transacted sessions, commit() and rollback() methods are used for committing receipt of a message. A call to commit(), confirms receipt of all messages on that session.
Similarly, if an Exception is thrown from onMessage(), it would be considered as rollback, and the message will remain in Queue for delivery.
Read more: https://javarevisited.blogspot.com/2020/05/top-16-jms-java-messaging-service-interview-questions-answers.html#ixzz7BwflkHk3
Posted Date:- 2021-11-11 07:31:03
PERSISTENT messages are those which sent with delivery mode DeliverMode.PERSISTENT and similarly for the non-persistent messages. A client makes a message PERSISTENT if message loses in transit in not affordable, while a client marks a message NON_PERSITENT if occasional message loses is OK.
Posted Date:- 2021-11-11 07:29:53
JMS provides different options to guarantee message delivery like PERSISTENT and NON_PERSISTENT deliver mode to guarantee the message is not lost during transportation. IT also provides JMS provider to specify retention policy for Queue and Topic, which can retain messages until it acknowledged or expired, or till certain delivery attempt. durable subscription is another way to ensure your Receiver, receives a message even if it is inactive when the publisher publishes the message.
Posted Date:- 2021-11-11 07:26:17
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 07:24:32
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 07:23:53
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.
Posted Date:- 2021-11-11 07:23:02
The types of messages that are supported by JMS are
* Stream Messages
* Text Messages
* Map Messages
* Bytes Messages
* Object Messages
Posted Date:- 2021-11-11 07:22:07
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.
Posted Date:- 2021-11-11 07:21:21
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.
Posted Date:- 2021-11-11 07:20:38
* 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.
Posted Date:- 2021-11-11 07:20:11
JMS has no inherent support for email operations.
Posted Date:- 2021-11-11 07:17:57
JMS client is a language program that sends or receives messages.
Posted Date:- 2021-11-11 07:17:30
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.
Posted Date:- 2021-11-11 07:17:03
If an EJB component-based application is deployed on any application server cluster, then it can be configured to run on any server inside the cluster to provide availability and scalability for the application.
If an EJB is in the form of Message Driven Bean (MDB), then it can run on any server inside the cluster and can be initiated parallel to a number of application servers in the cluster.
Posted Date:- 2021-11-11 07:16:26
Glassfish server is actually an application server and can be also used as web servers which means it can handle HTTP requests from the web browsers.
As an application server, it is developed to handle all types of Java Enterprise applications in terms of servlets/JSP and also EJB components.
Whereas, Tomcat server is actually a servlet container that is generally used for handling servlet or JSP components.
Posted Date:- 2021-11-11 07:16:00
The main class responsible for throwing JMS related exceptions by JMS API is JMSException.
Catching JMSException provides a generic way of handling all the exceptions related to the JMS API.
The JMS Exception class includes the following subclasses, that are described in the API documentation:
* IllegalStateException
* InvalidClientIDException
* InvalidDestinationException
* InvalidSelectorException
* JMSSecurityException
* MessageEOFException
* MessageFormatException
* MessageNotReadableException
* MessageNotWriteableException
* ResourceAllocationException
* TransactionInProgressException
* TransactionRolledBackException
Posted Date:- 2021-11-11 07:14:24
A message producer is basically a component which is created by a JMS session for sending a message to the receiver application.
One can create a session and implement the MessageProducer interface to define a destination object, queue object or topic object. One can declare a producer as unspecified by assigning null in its argument instead of an object. Later we can use Java method overloading on the send method to specify a destination, message as arguments or parameters.
Posted Date:- 2021-11-11 07:10:56
The components of JMS are as follows-
* JMS Provider
A messaging system that implements the JMS interfaces and provides administrative and control features.
* Clients
Java applications that send or receive JMS messages. A message sender is called the Producer, and the recipient is called a Consumer
* Messages
Objects that communicate information between JMS clients.
* Administered objects
Preconfigured JMS objects created by an administrator for the use of clients.
Posted Date:- 2021-11-11 07:10:25
publish-subscribe or pub/sub and point to point or simply PTP, are two most used architecture in the messaging world. As there name suggest, if communication happens between two parties i.e. one sender and only one receiver then it's called a Point to Point messaging, while if you have many receivers, who are interested in a message sent by one producer, than you use a publish-subscribe model, where you use Topics, which is subscribed by each consumer.
Almost all messaging products support both forms of messaging in one way or another. Tibco Rendezvous supports point to point messaging as request/reply mode, while in JMS based messaging products you can simply use Queue for point to point messaging.
Posted Date:- 2021-11-11 07:07:57
JMS has no standard APIs supporting the feature however we can use JavaMail to send automated emails.
Posted Date:- 2021-11-11 04:20:53
Given below are a few ways in which a message is sent through JMS:
* Implement JNDI to look up the credentials of the connectionFactory.
* Create a connectionFactory object for implementation.
* Identify the destination objects(one or more).
* Utilize the connectionFactory object to establish the JMS connection.
* Create one or more sessions.
* Use a Session and the Destinations to create the MessageProducers and MessageConsumers needed.
* Communicate using the channel.
Posted Date:- 2021-11-11 04:19:28
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 04:16:52
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 04:16:25
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.
Posted Date:- 2021-11-11 04:15:58
The types of messages that are supported by JMS are
* Stream Messages
* Text Messages
* Map Messages
* Bytes Messages
* Object Messages
Posted Date:- 2021-11-11 04:15:32
A StreamMessage object is used to send the stream of primitive data types in the Java programming language. The data are sequentially filled and read. It inherits from the Message interface and adds a stream message body.
java.io.DataInputStream and java.io.DataOutputStream are APIs supporting these types of messaging.
Posted Date:- 2021-11-11 04:14:54
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.
Posted Date:- 2021-11-11 04:14:08
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.
Posted Date:- 2021-11-11 04:12:07
Since the MOM middleware operates between the sender and receiver component it takes care of the message and transports the message by queuing mechanism. So, until the destination/receiver application becomes available to receive/read the message, the message is stored in a queue.
The most important part is that the method responsible for sending the message is not occupied until the receiver application receives the message. Thus, both the sender and receiver application works independently without any time dependency.
Posted Date:- 2021-11-11 04:10:50
Message Oriented Middleware is a software that works between the sender application and destination application in the JMS working model.
Posted Date:- 2021-11-11 04:08:39
The identifiable difference between the two models lies between the way in which the message is delivered.
In the case of JMS, the sender application sends the message to the destination application and then it again waits/or processes another message as per the programming criteria.
While in the case of RPC, the thread is completed once the message reaches the destination and the control comes back to the method responsible for message transport.
Posted Date:- 2021-11-11 04:06:11
JMS client is a language program that sends or receives messages.
Posted Date:- 2021-11-11 04:04:15
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.
Posted Date:- 2021-11-11 04:03:51
The different types of messages available in JMS API are Message, TextMessage, BytesMessage, ObjectMessage and MapMessage.
Posted Date:- 2021-11-11 04:03:32
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.
Posted Date:- 2021-11-11 04:03:14
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.
Posted Date:- 2021-11-11 04:02:54
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.
Posted Date:- 2021-11-11 04:02:41
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.
Posted Date:- 2021-11-11 04:02:21
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.
Posted Date:- 2021-11-11 04:02:03
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.
Posted Date:- 2021-11-11 04:01:24
* JMS provider
* JMS client
* Messages
* Administered objects
* Native clients
Posted Date:- 2021-11-11 04:01:02
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.
Posted Date:- 2021-11-11 04:00:28
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 03:58:00
There are two types of messaging models that JMS provides –
* Point to point queuing
* Second one is publish and subscribe
Posted Date:- 2021-11-11 03:53:35
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.
Posted Date:- 2021-11-11 03:52:23
JMS provides both type of messaging,
* synchronous
* Asynchronous
Posted Date:- 2021-11-11 03:50:46
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.
Posted Date:- 2021-11-11 03:49:10