The Application Client
The
SimpleMessageClient
sends messages to the queue that theSimpleMessageBean
listens to. The client starts by injecting the the connection factory and queue resources:@Resource(mappedName="jms/ConnectionFactory") private static ConnectionFactory connectionFactory; @Resource(mappedName="jms/Queue") private static Queue queue;Next, the client creates the connection, session, and message producer:
connection = connectionFactory.createConnection(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); messageProducer = session.createProducer(queue);Finally, the client sends several messages to the queue: