Download
FAQ History |
API
Search Feedback |
The Application Client
The
SimpleMessageClient
sends messages to the queue that theSimpleMessageBean
listens to. The client starts by locating the connection factory and queue:connectionFactory = (ConnectionFactory) jndiContext.lookup ("java:comp/env/jms/MyConnectionFactory"); destination = (Queue) jndiContext.lookup("java:comp/env/jms/QueueName");Next, the client creates the queue connection, session, and sender:
connection = connectionFactory.createConnection(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); messageProducer = session.createProducer(destination);Finally, the client sends several messages to the queue:
Download
FAQ History |
API
Search Feedback |
All of the material in The J2EE(TM) 1.4 Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.