JavaBeat FAQs
Sponsors
JAVABEAT
Home
Articles
Tips
QnA
Forums
FAQs Topics Books Topic
Java Java Books
Struts Struts Books
Spring Spring Books
Hibernate Hibernate Books
JBoss Seam Seam Books
J2EE J2EE Books
EJB EJB Books
JSF JSF Books
Servlets Servlets Books
JDBC JDBC Books
RMI RMI Books
JMS JMS Books
JNI JNI Books
Design Patterns Patterns Books
Exception Exception Books
Apache Ant Ant Books
Groovy
Cobertura
Quartz

Java Messaging Service(JMS) Interview Questions

JMS FAQs - 1 | JMS FAQs - 2

JMS Interview Questions - Part2


1)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

2)Is it possible to send email messages using JMS?
JMS has no inherent support for email operations.

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


4)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:

  1. From JMS domain to JavaMail domain (a javax.jms.Message is received):
    1. A JMS topic/queue can be associated with one or many e-mail id(s).
    2. The JMS Message Header can be mapped to ‘custom’ JavaMail Message Header.
    3. The JMS Message Body can be associated with the JavaMail Message body.
    4. A JavaMail client application should be able to process these ‘custom’ headers and the content of the message body.
 
  1. From JavaMail domain to JMS domain (a javax.mail.Message is received):
    1. An e-mail id can be associated with one or more JMS topics/queues.
    2. The JavaMail Message Header can be mapped to ‘custom’ JMS Message Header.
    3. The JavaMail Message Body can be associated with the JMS Message body.
    4. 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.


5)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".


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


7)How does the Application server handle the JMS Connection?

  1. Application server creates the server session and stores them in a pool.
  2. Connection consumer uses the server session to put messages in the session of the JMS.
  3. Server session is the one that spawns the JMS session.
  4. Applications written by Application programmers creates the message listener.
Bookmark This Page : | | | | | | | | | | |
Related Articles
Liferay Portal Enterprise Intranets
ZK Developer’s Guide : Online Media Library
The BIRT Environment and Your First Report
AJAX - The Complete Reference
The Java 6.0 Compiler API
Spring Web Flow - Introduction
Introduction to Spring Web Framework
Integrating Struts With Spring
What's new in Struts 2.0? - Struts 2.0 Framework
Introductiion to Jakarta Struts
more articles
java6 ejb3 jsf hibernate eclipse ajax groovy spring seam java struts webservice j2me guice java5 jca tapestry soa linux ria

Sponsors
Webmaster Hosting Forum
Java Jobs
Latest in DLinks
http://javawave.blogspot.com/2008/04/quartz-job-scheduler-part-ii-example.html
Quartz Job Scheduler -- Part 1 (Setting up development project in Netbeans 6.1 beta)
Flex Messaging with BEA Workshop Studio
SOA and Virtualization: How do They Fit Together?
Introduction to Enterprise Portals - Why they Benefit IT and the Business
BEA WebLogic Operations Control: Application Virtualization for Enterprise Java
Best Practices for Building Production Quality EAR Files
BEA's SOA Reference Architecture - A Foundation for Business Agility
Blueprint for Successful SOA Integration
Guardian - What a tool!

JavaBeat Media (2004-2008), India
javabeat home | About Us
our network : opensource softwares
Copyright © 2007 JavaBeat