Get the Sample MDB running with TIBCO Enterprise Message Service


Create the TIBCO Enterprise Message Service Administered Objects

  1. Start the TIBCO Enterprise Message Service server.
  2. Start the admin tool and enter the following commands:
  3.    > create factory sample.TCF topic 
       > create factory sample.QCF queue 
       > create topic sample.* 
       > create jndiname sample.listen topic sample.* 
       > create topic sample.weather 
       > create topic sample.sport 
       > create topic sample.news 
       > create queue sample.Q1 
       > create queue sample.Q2 
    

Configure WebSphere for the TIBCO Enterprise Message Service JNDI Provider

  1. Create a text file called jndi.properties in the directory <install_root>\AppServer\lib\ext.
  2. Add the following line into the file:
  3. java.naming.factory.url.pkgs=com.tibco.tibjms.naming 
    
  4. Save the jndi.properties file.

This allows both the WebSphere application server and client container to find the TIBCO Enterprise Message Service URLConnectionFactory when it encounters the tibjmsnaming JNDI naming scheme.

Add TIBCO Enterprise Message Service as a JMS Provider to the Application Server

  1. Start the WebSphere application server (if you have not already done so).
  2. Start the WebSphere Administrative Console.
  3. Expand Resources and choose Generic JMS Providers.
  4. Click the New button.
  5. Enter the following values for the given properties:

Name

TIBCO 

Description

TIBCO Enterprise Message Service 

Classpath

C:\tibco\EMS\clients\java\tibjms.jar 

External Initial Context Factory

com.tibco.tibjms.naming.TibjmsInitialContextFactory

External Provider URL

tibjmsnaming://localhost:7222

  1. Click the OK button.
  2. Click the Save button on the task bar at the top of the console window.
  3. To have the changes take effect immediately, stop and restart the application server.

More information about this task can be found in the WebSphere Application Server Version 5 Documentation On-line InfoCenter under: Resources > Messaging > Using JMS and messaging in applications > Administering JMS WebSphere support > Installing and configuring a JMS provider > Defining a generic JMS provider.

Configure JNDI Bindings for TIBCO Enterprise Message Service Connection Factories for the Application Server

  1. From the WebSphere Administrative Console, expand Resources and choose Generic JMS Providers.
  2. In the content pane, choose TIBCO.
  3. Scroll down and choose JMS Connection Factories.
  4. Click the New button.
  5. Enter the following values for the given properties:

Name

TIBCOConnectionFactory1 

Type

TOPIC 

JNDI Name

jms/ConnectionFactory1 

Description

Sample Topic ConnectionFactory

External JNDI Name

tibjmsnaming://localhost/sample.TCF

  1. Click the OK button.
  2. Click the New button.
  3. Enter the following values for the given properties:

Name

TIBCOConnectionFactory 

Type

QUEUE 

JNDI Name

jms/ConnectionFactory 

Description

Sample Queue ConnectionFactory

External JNDI Name

tibjmsnaming://localhost/sample.QCF

  1. Click the OK button.
  2. Click the Save button on the task bar of the Administrative Console (and Save again to confirm),
  3. To have the changes take effect immediately, stop and restart the application server.

More information about this task can be found in the WebSphere Application Server Version 5 Documentation On-line InfoCenter under: Resources > Messaging > Using JMS and messaging in applications > Administering JMS WebSphere support > Configuring JMS provider resources > Configuring resources for a generic JMS provider > Configuring a JMS connection factory, generic JMS provider.

Configure JNDI Bindings for TIBCO Enterprise Message Service Destinations for the Application Server

  1. From the WebSphere Administrative Console, expand Resources and choose Generic JMS Providers.
  2. In the content pane, choose TIBCO.
  3. Scroll down and choose JMS Destinations.
  4. Click the New button.
  5. Enter the following values for the given properties:

Name

Listen 

Type

TOPIC 

JNDI Name

jms/listen 

Description

Sample Listen Topic

External JNDI Name

tibjmsnaming://localhost/sample.listen

  1. Click the OK button.
  2. Repeat the previous steps to create the following additional destinations:

Name
Type
JNDI Name
Description
External JNDI Name
News
TOPIC
jms/news
Sample News Topic
tibjmsnaming://localhost/sample.news
Sport
TOPIC
jms/sport
Sample Sport Topic
tibjmsnaming://localhost/sample.sport
Weather
TOPIC
jms/weather
Sample Weather Topic
tibjmsnaming://localhost/sample.weather
Q1
QUEUE
jms/Q1
Sample Q1 Queue
tibjmsnaming://localhost/sample.Q1
Q2
QUEUE
jms/Q2
Sample Q2 Queue
tibjmsnaming://localhost/sample.Q2

  1. Click the Save button on the task bar of the Administrative Console (and Save again to confirm).
  2. To have the changes take effect immediately, stop and restart the application server.

More information about this task can be found in the WebSphere Application Server Version 5 Documentation On-line InfoCenter under: Resources > Messaging > Using JMS and messaging in applications > Administering JMS WebSphere support > Configuring JMS provider resources > Configuring resources for a generic JMS provider > Configuring a JMS destination, generic JMS provider.

Create new Listener Ports for TIBCO Enterprise Message Service

  1. From the WebSphere Administrative Console, expand Servers and choose Application Servers.
  2. In the content pane, choose the name of the application server.
  3. In the Additional Properties Table, select Message Listener Service.
  4. In the content pane, select Listener Ports.
  5. In the content pane, click the New button.
  6. Enter the following values for the given listener port properties:

Name

TIBCOPtoPListenerPort 

Initial State

Started 

Description

Listener Port for TIBCO Point to 
Point 

ConnectionFactory JNDI Name

jms/ConnectionFactory

Destination JNDI Name

jms/Q1

  1. Click the OK button.
  2. Repeat the previous steps to create another listener port with the following property values:

Name

TIBCOPubSubListenerPort 

Initial State

Started 

Description

Listener Port for TIBCO PubSub 

ConnectionFactory JNDI Name

jms/ConnectionFactory1

Destination JNDI Name

jms/listen

  1. Click the Save button on the task bar of the Administrative Console (and Save again to confirm).
  2. Stop and restart the application server to have the changes take effect.
  3. After the application server has restarted, use the WebSphere Administrative Console to verify that the new listener ports are in their proper initial state.
  4. To do this, expand Servers->Application Servers, then choose your server name in the content pane, then on Message Listener Service and then on Listener Ports. The new TIBCO listener ports should have a solid green arrow under the status column indicating that they are started.

More information about this task can be found in the WebSphere Application Server Version 5 Documentation On-line InfoCenter under: Applications > EJB modules > Using message-driven beans in applications > Configuring message listener resources for message-driven beans > Adding a new listener port.

Reassemble the Sample MDBs to Use the New TIBCO Enterprise Message Service Listener Ports

  1. Start the WebSphere Application Assembly Tool.
  2. Open the MDBSamples.ear file located in the <install_root>/AppServer/samples/lib/MessageDrivenBeans directory.
  3. In the navigation pane, expand MDBSamples->EJB Modules->PSSampleMDB.jar.
  4. Choose Message Driven Beans, then in the content pane, choose PSSampleMDB.
  5. Click the Bindings tab in the property pane.
  6. Change the value of the Listener Port Name from SamplePubSubListenerPort to TIBCOPubSubListenerPort.
  7. Click the Apply button.
  8. In the navigation pane, expand MDBSamples->EJB Modules->PtoPSampleMDB.jar.
  9. Choose Message Driven Beans, then in the content pane, choose PtoPSampleMDB.
  10. Click the Bindings tab in the property pane.
  11. Change the value of the Listener Port Name from SamplePtoPListenerPort to TIBCOPtoPListenerPort.
  12. Click the Apply button.
  13. Choose File->Save from the menu.

More information about this task can be found in the WebSphere Application Server Version 5 Documentation On-line InfoCenter under: Applications > EJB modules > Using message-driven beans in applications > Deploying an enterprise application to use message-driven beans > Configuring deployment attributes for a message-driven bean.

Redefine the Resource Reference and Resource Environment Reference for the Point-to-Point Sample MDB

  1. In the navigation pane of the WebSphere Application Assembly Tool, under MDBSamples, expand EJBModules->PtoPSampleMDB.jar->Message Driven Beans->PtoPSampleMDB.
  2. Choose Resource References. The name JMS/SamplePPQCF should appear in the content pane.
  3. Click the Bindings tab.
  4. Change the value of JNDI Name from Sample/JMS/QCF to tibjmsnaming://localhost/sample.QCF.
  5. Click the Apply button.
  6. In the navigation pane, choose Resource Environment References. The name JMS/SampleOutputQueue should appear in the content pane.
  7. Click the Bindings tab.
  8. Change the value of JNDI Name from Sample/JMS/Q2 to tibjmsnaming://localhost/sample.Q2.
  9. Click the Apply button.
  10. Choose File->Save from the menu.

Redefine the Resource Environment References in the Application Client Samples

  1. Expand MDBSamples->Application Clients->PSSampleClient->Resource Environment References.
  2. In the content pane, choose jms/news and then click the Bindings tab.
  3. Change the value of the JNDI name from thisNode/servers/server1/Sample/JMS/news to tibjmsnaming://localhost/sample.news.
  4. Click the Apply button.
  5. Choose jms/sport and then click the Bindings tab.
  6. Change the value of the JNDI name from thisNode/servers/server1/Sample/JMS/sport to tibjmsnaming://localhost/sample.sport.
  7. Click the Apply button.
  8. Choose jms/weather and then click the Bindings tab.
  9. Change the value of the JNDI name from thisNode/servers/server1/Sample/JMS/weather to tibjmsnaming://localhost/sample.weather.
  10. Expand MDBSamples->Application Clients->PtoPSampleClient->Resource Environment References.
  11. Choose jms/Q1 and then click the Bindings tab.
  12. Change the value of the JNDI name from thisNode/servers/server1/Sample/JMS/Q1 to tibjmsnaming://localhost/sample.Q1.
  13. Click the Apply button.
  14. Choose jms/Q2 and then click the Bindings tab.
  15. Change the value of the JNDI name from thisNode/servers/server1/Sample/JMS/Q2 to tibjmsnaming://localhost/sample.Q2.
  16. Click the Apply button.
  17. Choose File->Save, then File->Close to save and then close the Application Assembly tool.

More information about this task can be found in the WebSphere Application Server Version 5 Documentation On-line InfoCenter under: Applications > Client Modules > Using application clients > Developing J2EE application client code.

Add TIBCO Enterprise Message Service as a JMS Provider to the Application Client

  1. Start the WebSphere Application Client Resource Configuration Tool from a console window by entering the following command:
  2.    install_root\AppServer\bin>clientConfig 
    
  3. Open the MDBSamples.ear file located in the <install_root>/AppServer/samples/lib/MessageDrivenBeans directory.
  4. Expand PSSampleClient.jar.
  5. Right-click on JMS Providers and select New.
  6. Enter the following values for the given properties:

Name

TIBCO 

Description

TIBCO Enterprise Message Service 

Classpath

C:\Tibco\EMS\clients\java\tibjms.jar 

ContextFactory Class

com.tibco.tibjms.naming.TibjmsInitialContextFactory

Provider URL

tibjmsnaming://localhost:7222

  1. Click the OK button.
  2. Repeat the previous three steps for PtoPSampleClient.jar.
  3. Save the EAR file by choosing File->Save from the menu.

More information about this task can be found in the WebSphere Application Server Version 5 Documentation On-line InfoCenter under: Applications > Client Modules > Using application clients > Deploying application clients > Configuring Java messaging client resources > Configuring new JMS providers with the Application Client Resource Configuration Tool.

Configure the JNDI bindings for TIBCO Enterprise Message Service Connection Factories for the Application Client

  1. In the Application Client Resource Configuration Tool for the MDBSamples.ear file, expand PSSampleClient.jar->JMS Providers->TIBCO.
  2. Right-click on JMS Connection Factories and select New.
  3. Enter the following values for the given properties:

Name

TIBCOConnectionFactory1 

Description

Sample Topic Connection Factory 

JNDI Name

jms/ConnectionFactory1 

External JNDI Name

tibjmsnaming://localhost/sample.TCF

Connection Type

TOPIC

  1. Click the OK button.
  2. Repeat the previous three steps for PtoPSampleClient.jar using the following values:

Name

TIBCOConnectionFactory 

Description

Sample Queue Connection Factory 

JNDI Name

jms/ConnectionFactory 

External JNDI Name

tibjmsnaming://localhost/sample.QCF

Connection Type

QUEUE

  1. Save the EAR file by choosing File->Save from the menu.
  2. Close the MDBSamples.ear file (File->Close).

More information about this task can be found in the WebSphere Application Server Version 5 Documentation On-line InfoCenter under: Applications > Client Modules > Using application clients > Deploying application clients > Configuring Java messaging client resources > Generic JMS connection factory settings for application clients.

Update the Deployed Application on the Server

  1. From the WebSphere Administrative Console, expand Applications and click on Enterprise Applications.
  2. Check the box in front of MDBSamples and click the Update button.
  3. Click the Browse button and locate the MDBSamples.ear file. On Windows, by default, it is located in: C:\Program Files\WebSphere\AppServer\samples\lib\MessageDrivenBeans.
  4. Click the Next button.
  5. Do not change any of the default settings on this page.
  6. Click the Next button.
  7. The "Step 1, Provide options to perform the installation" page appears. Do not change any of the default settings on this page.
  8. Click the Next button.
  9. The "Step 2, Provide Listener Ports for Messaging Beans" appears. It should already contain the names of the new listener ports previously created.
  10. Click the Next button.
  11. The "Step 3, Map resource references to resources" page appears. It should already contain the binding for the jms/SamplePPQCF reference for the PtoPSampleMDB.
  12. Click the Next button.
  13. The “Step 4, Map resource env entry references to resources” page appears. It should already contain the binding for the jms/SampleOutputQueue reference for the PtoPSampleMDB.
  14. Click the Next button.
  15. The "Step 5, Map virtual hosts for web modules" page appears. Do not change any of the default settings on this page.
  16. Click the Next button.
  17. The "Step 6, Map modules to application servers" page appears. Do not change any of the default settings on this page.
  18. Click the Next button.
  19. The "Step 7, Summary" page appears.
  20. Click the Finish button.
  21. The message "Application MDBSamples installed successfully" appears in the content window.
  22. Choose Save to Master Configuration.
  23. Click Save again.

More information about this task can be found in the WebSphere Application Server Version 5 Documentation On-line InfoCenter under: Applications > Deployment > Deploying and managing applications > Updating Applications.

Run the Samples Application Client

  1. From the <install_root>\samples\bin\MessageDrivenBeans directory, type: RunPSclient. You should see the same results as you saw in part I for the publish/subscribe sample.
  2. From the <install_root>\samples\bin\MessageDrivenBeans directory, type: RunPtoPclient. You should see the same results as you saw in part I for the point-to-point sample.

TIBCO Enterprise Message Service™ Application Integration Guide
Software Release 4.3, February 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com