16.10.2015 Views

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.

Chapter 6 – Messaging 113<br />

2. Get JMS resources including ConnectionFactory and Queue/Topic in the<br />

JMS resource group. There are three ways to get JMS resources.<br />

- Use JNDI looking up in a servlet/EJB.<br />

- Use resource injection in a servlet/EJB.<br />

- Use ActiveMQConnectionFactory API to connect to a JMS provider<br />

directly from a stand-alone Java application.<br />

3. After getting ConnectionFactory and Destinations:<br />

- Use ConnectionFactory to create a Connection.<br />

- Use Connection to create a Session.<br />

4. Use the Session to create a MessageProducer or MessageConsumer to<br />

the Destination.<br />

5. Use the MessageProducer to send messages, use the MessageConsumer to<br />

receive messages.<br />

6.3 Configuring a JMS resource group in Community Edition<br />

A JMS provider acts as an intermediary between message producers and consumers. You<br />

need a JMS provider for JMS applications to send and receive messages. Before<br />

developing JMS applications, you have to create a JMS resource group including<br />

ConnectionFactory and Destinations in JMS provider.<br />

6.3.1 Creating a JMS resource group<br />

To create a JMS resource group in Community Edition, you need to:<br />

1. Start the Community Edition server and launch the Community Edition administrative<br />

console (login as system <strong>with</strong> password manager).<br />

2. In the left hand navigation pane, select Services -> JMS Resources to open the JMS<br />

Resources editor as shown in Figure 6.4.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!