Getting Started with WebSphere Application Server
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
6<br />
Chapter 6 – Messaging<br />
Messaging is a way to communicate asynchronously, similar to an e-mail system. The<br />
sender creates a message, and sends it to a messaging destination through a messaging<br />
subsystem. The messaging subsystem accepts it for delivery and holds it. The receiver<br />
checks the messaging subsystem to receive the message.<br />
Messaging allows for a loosely coupled solution. The sender application only has to ensure<br />
that the message was accepted for delivery and then can proceed <strong>with</strong> other processing.<br />
An outage on either the sender or receiver parts, do not immediately affect the entire<br />
system.<br />
Java Message Service (JMS) is used to support messaging in the Java EE world.<br />
In this chapter you will learn about:<br />
• How to configure a JMS resource group<br />
• How to use JMS resources in different applications of Community Edition.<br />
6.1 Community Edition Messaging: The big picture<br />
Figure 6.1 provides an overview on how messaging works in Community Edition. First in<br />
(1), an administrator creates a JMS resource group in the server. Then there are three<br />
ways to use the created JMS resource group:<br />
• In (2a) and (2a.1), the Servlet/jsp uses JNDI lookup or resource injection to get a<br />
reference to the JMS resources, and then uses this reference to send or receive<br />
messages of the JMS resource in the server.<br />
• In (2b) and (2b.1), you can use annotation to specify the JMS queue or topic that the<br />
Message Driven Bean (MDB) listens to. When the message arrives, the MDB will<br />
react according to the content of received message.<br />
• In (2c), a standalone java client (POJO client) can use<br />
ActiveMQConnectionFactory API to get the JMS resource and use the JMS<br />
resource directly.