11) 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.
12) Is it possible to send email messages using JMS?
JMS has no inherent support for email operations.
13)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.
14)Is there any relationship between javax.jms.Message and javax.mail.Message?
There is no direct relationship between javax.mail.Message and javax.jms.Message. If your requirement is to map (correlate) them, here is what you can do:
- From JMS domain to JavaMail domain (a javax.jms.Message is received):
- A JMS topic/queue can be associated with one or many e-mail id(s).
- The JMS Message Header can be mapped to ‘custom’ JavaMail Message Header.
- The JMS Message Body can be associated with the JavaMail Message body.
- A JavaMail client application should be able to process these ‘custom’ headers and the content of the message body.
- From JavaMail domain to JMS domain (a javax.mail.Message is received):
- An e-mail id can be associated with one or more JMS topics/queues.
- The JavaMail Message Header can be mapped to ‘custom’ JMS Message Header.
- The JavaMail Message Body can be associated with the JMS Message body.
- The JMS client application should be able to process these ‘custom’ headers and the content of the message body.
In a simple application that I tried, I removed the ‘custom’ header scenario and just forwarded the contents of the message (text message), which worked without any problems.Try using SonicMQ bridges, which already has something like that.
15) 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”.
16) 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.
17) 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.