< Previous | Next >

Lesson 1.1: Creating a server and server configuration for JMS

In this lesson you will learn how to create a JMS server configuration for use with Web services.

You can import the required EAR file using the project interchange wizard:
Import the JMSEAR.ear

In the J2EE perspective notice JMSService. This project contains all the resources for EJB applications, including the enterprise bean, the remote interface, and EJB home. The JMSServiceRouter project has also been created. This is an EJB project that will contain the message router message-driven bean for the Web service.

Create a JMS Server

You can create a JMS server by following these steps:
  1. From the File menu, select New > Other > Server > Server > Next.
  2. Select WebSphere v6.1 Server as the server type. Click Next.
  3. If this runtime has not been created in your workspace, you will be prompted to select the installation directory for the server. Click Next.
  4. Accept the default server port and name. Click Next.
  5. Select the JMSEAR from the list of available projects and click Add to target it to the server. Click Finish.
  6. Wait for the server to start. once it has started the console will display Server server1 open for e-business;

Configuring the server to work with JMS

JMS settings for this server must be set in the WebSphere Application Server administrative console. The console can be launched through the Start menu on Windows, or through a Web browser at: http://localhost:9060/ibm/console
  1. Once you have launched the console, select Servers > Application Servers to ensure that the server you created is listed.
  2. In the left-hand pane, expand Service Integration > Buses and click New. Enter a unique name in the Name field (for example WS_tutorial_bus) and click Next and then Finish.
  3. To associate the current server with the newly created integration bus, select the name of the bus you have just created, under Topology click Bus members. Click Add and select the server you want to associate the integration bus and then click Next. Select File store as the message persistence state and click Next. You can accept the default message store properties for this tutorial and click Next. If you are creating a JMS bus for your own Web service, select Help and search on "File store settings" for additional information about which settings are best for you. Click Finish to confirm.
  4. Create a physical queue for the request message:
    1. In the left-hand pane, expand Service Integration > Buses. Select the bus created earlier.
    2. Under Destination resources click Destinations.
    3. On the destinations page click on New .
    4. Choose Queue as the destination type and click Next.
    5. Enter an identifier such as ws_tutorial_queueJms. Click Next
    6. Accept the default bus member. Click Next.
    7. Click Finish to confirm your changes, and then save your changes.
  5. Assign JMS settings against the newly created queue:
    1. In the left-hand navigation panel, go to Resources > JMS > JMS Providers.
    2. From the Scope drop-down list select the server as your scope, and from the provider list select Default messaging provider.
    3. Under Additional Properties select Queue.
    4. Enter a name (for example ws_tutorial_queueJms) and JNDI name (for examplejms/ws_tutorial_queue). In the connection pane, select the bus (WS_tutorial_bus) and Queue (ws_tutorial_queueJms) you created earlier.
    5. Click OK to save the changes.
  6. Create a queue connection factory for the input queue:
    1. Go to Resources > JMS > Queue connection factories.
    2. From the Scope drop-down list select the server as your scope, and click New.
    3. Select the default messaging provider and click OK.
    4. Under General Properties enter a name (for example WebServicesInput_QCF) and a JNDI name (for example jms/ws_tutorial_qcf ).
    5. In the Connection pane select the bus created earlier (WS_tutorial_Bus) as the bus name.
    6. Click OK to save the changes.
  7. Create a queue connection factory for the reply queue:
    1. Go to Resources > JMS > Queue connection factories.
    2. From the Scope drop-down list select the server as your scope, and click New.
    3. Select the default messaging provider and click OK.
    4. Under General Properties enter WebServicesReply_QCF as the name (you must use WebServicesReply_QCF for this field) and a JNDI name (for examplejms/WebServicesReplyQCF). If you want to use a custom name for the reply queue connection factory you have to change the reference alias in the JMSServiceRouter deployment descriptor. This reference is set up when you run the Web service wizards. Thus if you decide to use a different JNDI name you have to go into this project and override the default setting.
    5. In the Connection pane select the bus created earlier (WS_tutorial_Bus) as the bus name and click OK to save the changes.
  8. A JMS activation specification is needed to bind the input queue and the listening message driven EJB:
    1. Go to Resources > JMS > Activation specifications.
    2. From the Scope drop-down list select the server as your scope, and click New.
    3. Select the default messaging provider and click OK.
    4. Enter a name (for example ws_tutorial_JMSRouter), and enter a JNDI name (for example eis/ws_tutorial_JMSRouter). In the Destination pane select Queue as the destination type, enter the destination JNDI name (jms/ws_tutorial_queue), and select the bus name (WS_tutorial_Bus).
    5. Click OK to save the changes.
  9. Once you have added the required connection factories and queues or topics, you can stop and restart WebSphere Application Server v6.1 and return to the development workspace.

Lesson Checkpoint

Now you are ready to begin Lesson 1.2: Creating the Web service.

Feedback

< Previous | Next >