Questions and Answers
If there is no ConnectionFactory object created by the JMS provider administrator, what can I do?
If there is no Destination object created by the JMS provider administrator, what can I do?
If I do not specify a value for the time-to-live method of the Message interface, what will happen to the message if the receiver is inactive?
Can I create two or more connections to send messages?
If I use transacted messaging and if the connection or session is closed in the middle of transmitting without an acknowledgment, what will happen to the message that is not sent to the destination?
I want to filter some messages that should not be delivered to the consumer. How can I define a field in a message selector for some values in the message body?
In the message received, there is a ReplyTo field. If this destination is not created, how can I send a message to the destination specified in a ReplyTo field?
A ConnectionFactory object is an administered object and must be created by the JMS provider administrator. If there is no ConnectionFactory object created, you can use the default ConnectionFactory object. You will learn more detailed information in the section, "Basic Steps to Write a JMS Application," in the next chapter.
A Destination object is an administered object like the ConnectionFactory object and must be created by the JMS provider administrator. If there is no Destination object created, you cannot use the JMS API for messaging. There is no default Destination object.
If you do not specify a time for time-to-live, it means that the message will never expire. The message will be delivered whenever the receiver client is available, depending on the messaging model you are using.
Yes, you can. Some advanced applications might use several connections. But a connection is a relatively heavyweight object. Therefore, only one connection is preferred. If you need to, you can create two or more sessionswhich are lightweight JMS objectsand a number of message producers and consumers to send messages on different channels.
In this case, the JMS provider will call the rollback() method, the messages that are not delivered will be deleted, and the messages already delivered to the destination will be removed from the destination by a JMS provider. The recipient will not receive any messages.
A message selector only works with header and property fields. You cannot filter messages based on values in the message body.
You can create a temporary destination dynamically. During the session, the connection is open, so you can send the message to this temporary destination. Whenever the connection is closed, this destination is removed along with the messages that have not yet been delivered.