Contents

FioranoMQ can be integrated with a WebSphere Application Server so that MDBs deployed on WebSphere can listen in for messages published on destinations that exist on the FioranoMQ Server.

This document provides instructions detailing the integration of FioranoMQ with a Web Sphere Application Server.

A sample code is provided in the attached zip file.

Assumptions

In the section below, the assumptions, below, have been made:

The Web Sphere Application Server and the Application Developer are installed in the \wsad directory. In case you have installed them in a different directory, please make the necessary changes.

FioranoMQ is installed in the \Program Files\Fiorano\FMQ directory. In case you have installed it in a different directory, please make the necessary changes.

Configuring WS Application Developer for FioranoMQ

The remaining sections in this document focus on the steps that need to be carried-out to configure the WebSphere Application Server via the WS Application Developer Environment. Instructions to configure the WebSphere Application Server via the WS Application Developer Environment are divided into the following sections:

  1. Define the WebSphere Test Server
  2. Configure WebSphere to be able to use FioranoMQ as a JMS provider
  3. Create/Configure MDB in the WebSphere Application Developer Environment
  4. Deploy/Test the MDB

Define a WebSphere Test Server

Below are the instructions to create and configure a WS Server to enable it to run an EJB component:

  1. Open a Server perspective in Application Developer.
  2. Right-click the Navigator view and select New > Server Project.
  3. Type ServerProject in the Project name field and click Finish.
  4. Right-click the ServerProject and select New > Server and Server Configuration.
  5. In the Server name field, type TestServer.
  6. Set the Server type as WebSphere 5.1 Test Environment.
  7. Click Finish.
  8. In the Server Configuration view, double-click TestServer under Server Configurations.
  9. Under the Configuration tab, check Enable administration client.
  10. Save the configuration by pressing Ctrl-S.
  11. In the Servers view, right-click on the TestServer and select Start.
  12. Wait until you see the message server1 open for e-business on the console before proceeding.

Configure WS to use FioranoMQ as JMS provider

EJB components can use the administered objects (Connection Factories and Destinations) residing on the FioranoMQ server.
Steps to define FioranoMQ as the JMS provider:

  1. In the Servers view, right-click the TestServer and select Run administrative client.
  2. At the Login screen, click Submit.
  3. Click the + sign next to Resources.
  4. Click Generic JMS Providers.
  5. Click New.
  6. In the Server Class Path field add the entries, separated by a semicolon, on a single line in the Server Class Path text field: <FMQ_HOME>\lib\fmq-rtl.jar
    (Where FMQ_HOME refers to the installation directory of FioranoMQ. This makes the FioranoMQ Java classes available to the server.)
  7. Change the Name: field to FioranoMQ.
  8. Change the Description:field to FioranoMQ as the JMS Provider for IBM Web-Sphere Application Server
  9. Change the External Initial Context Factory: field to fiorano.jms.runtime.naming. FioranoInitialContextFactory.
  10. Change the External Provider URL: field to *http://localhost:1856*
  11. Click OK and then save the changes.

Steps to configure the JMS Destination under FioranoMQ resource:

  1. Click the FioranoMQ link under Generic JMS Providers, and click JMS Destinations.
  2. Click New. In the Name: field, type MyQueue.
  3. Change the JNDI Name: field to jms/MyQueue.
  4. Set the DestinationTypefield to QUEUE.
  5. In the External JNDIName field, type primaryQueue and click OK.
  6. Go to the FioranoMQ link under Generic JMS Providers.
  7. Click JMS Connection Factories.
  8. Click New. In the Name: field type MyQCF.
  9. Change the JNDIName: field to jms/MyQCF.
  10. Change the ExternalJNDIName: field to primaryQCF.
  11. Set the ConnectionType: field to QUEUE and click OK.
  12. Click the Save link at the top of the page to save all changes to the master configuration.

Create/Configure MDB in WebSphere application developer

MDB can be created by following the steps below:

Create the new EJB Project

  1. Switch to the J2EE navigator view in the J2EE perspective.
  2. Start creating a new project by selecting File > New > EJB Project. This opens the EJB Project Creation wizard. Check that a 2.0 EJB Project is in the process of being created and click Next.
  3. Specify the Project name as MDB and EAR Project to as FioranoEAR. Click on Finish. The Application Developer creates the new project.

Create the bean class

  1. In the J2EE Hierarchy view right-click on the new MDB EJB module and select New > Enterprise Bean. This opens the Enterprise Bean Creation wizard.
  2. Check that the specified EJB project is MDB. Click Next. The bean type and Properties panel is displayed.
  3. Specify the type of message-driven Bean. The Bean name is QReceiver and the default package is named fiorano.jms. Click Next.
  4. Specify the transaction as container and the destination as Queue. Set the listenerPort to ReceiverListenerPort. Click Finish. The Application Developer creates the Receiver MDB.


Complete the Bean Class

Once the Application Developer has created the Receiver MDB, a new entry called QReceiver appears under the MDB EJB module in the J2EE hierarchy view.

  1. Expand the QReceiver entry and double-click the QReceiver-Bean to open its editor.
  2. In the QReceiverBean editor there are a series of methods that are defined by the Application Developer upon the creation of the Receiver MDB.
  3. Modify the Bean's onMessage () method to print the message on the console. Save the changes. (Modified QReceiver-Bean.java is also provided with this document for reference.)

Configure the Message Listener Service

The User must configure the destination on which the bean listens for published messages. To configure this destination, follow the instructions below:

  1. Log in to the administrative console.
  2. Expand the Servers entry in the left-hand navigation frame and click Application Servers.
  3. In the frame that is displayed, click on server1 and then Message Listener Service in the Additional Properties table. This opens the message listener configuration frame.
  4. Click Listener Ports. Click on New to create a new Listener Port for the Receiver MDB.
  5. Specify the name of the port as ReceiverListenerPort and the Connection Factory name as jms/MyQCF. The destination name is jms/MyQueue. Note: These names match the Connection Factory name and Destination name used while configuring the WS Server to use FioranoMQ as a JMS provider.
  6. Click on OK. Click the Save button to save changes.
  7. Close the administrative console. The Receiver MDB is now ready for deployment.

Deploy/Test the MDB

Deploy MDB

To deploy an MDB, follow the instructions given below:

  1. Start the FioranoMQ Server on the same machine as the WSAD. (Start > Programs > Fiorano > FioranoMQ > FioranoMQ Server).
  2. Right-click the Receiver MDB entry in the J2EE Hierarchy. Click Run on the Server.
  3. In the server selection window, choose the existing server as TestServer. Click Next.
  4. Deploy EJB Beans and click Finish.

If the Test Server was running, it will restart after deployment.

Test the MDB

The MDB begins listening for messages on jms/MyQueue upon deployment. So a message is pushed onto the primaryQueue (for example, via a Sender sample) then the message will show up in the console window of the Application Developer as Test Server.

  1. Launch the FioranoMQ Application Console (by clicking on Start > Programs > Fiorano > FioranoMQ > FioranoMQ Console).
  2. Run a Sender Application (present in the fmq\samples\Ptp\SendReceive directory) using the command below: run-client QSender
  3. Send a message. The console view of the WS Application Developer will display:



Adaptavist ThemeBuilder EngineAtlassian Confluence