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: