Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Integrating business processes with TIBCO Enterprise Message Service and WebSphere Process Server

Abhay Srivastava (abhay_iitm@yahoo.com), Senior Software Engineer, Prolifics
Photo of Abhay Srivastava
Abhay Srivastava is a Senior Software Engineer working on IBM WebSphere Process Server. His focus area is around BPEL business processes, Web services, Common Event Infrastructure, ws-security and mediation primitives. He is an engineering graduate from the Indian Institute of Technology, Madras. You can reach him at abhay_iitm@yahoo.com.

Summary:  In many businesses, customers are using WebSphere Process Server to integrate with their existing messaging infrastructure. Some of these customers use WebSphere Process Server with non-IBM messaging platforms. This article demonstrates how to integrate TIBCO Enterprise Message Service, a commonly seen messaging environment, with WebSphere Process Server. You will notice the subtleties of integrating business processes with EMS, the problems posed, and the solutions to these problems. You will also learn how to configure messaging resources and Service Integration Bus.

Date:  20 Jun 2007
Level:  Intermediate

Activity:  13977 views
Comments:  

Introduction

IBM® WebSphere® Process Server is a business process integration server that helps you solve complex business flows and a platform that you can use to connect to various technologies. Businesses seeking to use WebSphere Process Server to implement these complex business processes have to be connected to other back-end or front-end systems in order for these business processes to work properly. TIBCO Enterprise Message Service (EMS) is a common messaging resource used by businesses. This article demonstrates how easily WebSphere Process Server processes can be connected to EMS. Since EMS supports Java™ Message Service (JMS), we will use the JMS support of WebSphere Process Server to bind to EMS. Using the techniques and configuration described in this article, you will be able to send messages to business processes.

Scenario

This article provides a scenario that consists of a message producer (Session Bean) that sends a message to EMS. A TIBCO Listener Bean picks up the message from the EMS queue and then sends it to the WebSphere Process Server (JMS) queue. The Business Process Execution Language (BPEL) business process picks up the message from the WebSphere Process Server queue and prints the contents. Figure 1 shows the visual representation of the flow:


Figure 1. The scenario shows the visual representation of the flow
Scenario shows the visual representation of the flow

Setting up the environment

Prerequisites

The following software is required to run this example:

  • WebSphere Integration Developer V6.0.x.
  • TIBCO EMS server.
  • WebSphere Process Server V6

Configuring EMS and WebSphere Process Server

This section walks you through the following steps for configuring EMS and WebSphere Process Server:

  • Start the EMS server.
  • Create the EMS administered objects.
  • Configure WebSphere Process Server for the EMS.
  • Add EMS as a JMS provider to WebSphere Process Server.
  • Configure the JNDI bindings for the EMS Connection Factories for WebSphere Application Server.
  • Configure the JNDI bindings for TIBCO Enterprise Message Service Destinations for WebSphere Application Server.
  • Create the Listener Ports for EMS.
  • Create the Connection Factories and Destinations for WebSphere Default Messaging.

Start the EMS server

You can begin by starting the EMS server:

  1. Install the EMS (evaluation copy).
  2. Start the EMS server. Choose Start => All Programs => TIBCO => TIBCO EMS Evaluation Version => Start EMS Server.
  3. Start the EMS server Admin Console. Choose Start => All Programs => TIBCO => TIBCO EMS Evaluation Version => Start EMS Server Administration Tool.
  4. Type in connect and press Enter.
  5. Press Enter for login and password (no security configured), and you will see a message saying connected to tcp://localhost:7222 and the same as the command prompt.

Create the EMS administered objects

Create the following objects administered by EMS:

  1. Start the admin tool and enter the following commands:
    1. Create factory sample.XAQCF xaqueue.
    2. Create queue sample.Q1.

Configure WebSphere Process Server for the EMS JNDI provider

You also need to configure WebSphere Process Server for the 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: java.naming.factory.url.pkgs=com.tibco.tibjms.naming.
  3. Save the jndi.propertiesfile.

This allows both the WebSphere Application Server and client container to find the EMS URLConnectionFactory when it encounters the tibjmsnaming JNDI naming scheme.

Adding EMS as a JMS provider to WebSphere Process Server Process Server

Complete the following steps to add EMS as a JMS provider to WebSphere Process Server Process Server.

  1. Start Process Server (if you have not already done so).
  2. Start the Process Server Administrative Console.
  3. Expand Resources and choose Generic JMS Providers.
  4. Click New.
  5. Enter the following values for the given properties: Name TIBCO Description TIBCO Enterprise Message Service Classpath point to location of tibjms.jar External Initial Context Factory com.tibco.tibjms.naming.TibjmsInitialContextFactory External Provider URL tibjmsnaming://localhost:7222.
  6. Click OK.
  7. Click Save on the task bar at the top of the console window.
  8. To have the changes take effect immediately, stop, and restart WebSphere Application Server.

Configure the JNDI bindings for EMS Connection Factories for WebSphere Application Server

Next, configure the JNDI bindings:

  1. From the Process Server 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 New.
  5. Enter the following values for the given properties:
    1. Name TIBCOConnectionFactory.
    2. Type QUEUE.
    3. JNDI Name jms/ConnectionFactory.
    4. Description Sample Queue ConnectionFactory.
    5. External JNDI Name sample.XAQCF.
  6. Click OK.
  7. Click Save on the task bar of the Administrative Console (and Save again to confirm).
  8. To have the changes take effect immediately, stop, and restart the WebSphere Application Server.

Configure the JNDI bindings for TIBCO Enterprise Message Service destinations for the WebSphere Application Server

Configure the JNDI bindings for TIBCO EMS destinations for WebSphere Application Server.

  1. From the Process Server 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 New.
  5. Enter the following values for the given properties:
    1. Name Q1.
    2. Type QUEUE.
    3. JNDI Name jms/Q1.
    4. Description Sample Listen Queue.
    5. External JNDI Name sample.Q1.
  6. Click OK.
  7. Click Save on the task bar of the Administrative Console (and Save again to confirm).
  8. To have the changes take effect immediately, stop and restart the WebSphere Application Server.

Create Listener Ports for EMS

Next, create the Listener Ports for EMS.

  1. From the Process Server 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 New.
  6. Enter the following values for the given listener port properties:
    1. Name TIBCOPtoPListenerPort.
    2. Initial State Started.
    3. Description Listener Port for TIBCO Point to Point.
    4. ConnectionFactory JNDI Name jms/ConnectionFactory.
    5. Destination JNDI Name jms/Q1.
  7. Click OK.
  8. Click Save on the task bar of the Administrative Console (and Save again to confirm).
  9. Stop and restart the application server to have the changes take effect.

After the application server has restarted, use the Process Server Administrative Console to verify that the new listener ports are in their proper initial state. To do this, expand Servers => Application Servers, then choose your server name in the following: content pane, Message Listener Service, and on Listener Ports. The new TIBCO listener ports should have a solid green arrow under the status column indicating that they are started.

Create Connection Factories and Destinations for WebSphere Default Messaging

Now, you can create the Connection Factories and Destinations:

  1. Create a Service Integration Bus (SIBus) named MyBus and Destination names TIBCO_WPS_Queue on this bus.
  2. Create a JMS Queue Connection Factory with following values:
    1. Name MyQueueConnectionFactory.
    2. JNDI Name jms/MyConnectionFactory.
    3. Bus MyBus.
  3. Create JMS Connection Factory.
    1. Name TibcoConnectionFactory.
    2. JNDI Name jms/TibcoConnectionFactory.
    3. Bus MyBus.
  4. Create a JMS Queue with following values:
    1. Name TIBCO_WPS_JMS_Queue.
    2. JNDI Name jms/tibcowpsq.
    3. Queue Name TIBCO_WPS_Queue.
    4. Bus MyBus.
  5. Create a JMS Activation Spec with following values:
    1. Name TIBCO_WPS_AS.
    2. JNDI Name eis/tibcowpsas.
    3. Destination Type Queue.
    4. Destination JNDI name jms/tibcowpsq.
    5. Bus MyBus.

Creating a business process

In order to create a business process, you need to create the library, business objects, interfaces, modules, and a business process.

  1. Open WebSphere Integration Developer and switch to the Business Integration perspective.

    Figure 2. Business Integration perspective
    Business Integration perspective

  2. From the Business Integration tab, choose New => Library to create a library called Tibco_Library.

    Figure 3. Tibco Library
    Tibco Library

  3. In the Library Name field, type in Tibco_Library, then click Finish.

    Figure 4. New library named Tibco Library
    New library named Tibco Library

  4. In the Tibco_Library, right-click the Data Types to create a new Business Object called TibcoMessage.

    Figure 5. Business Object
    Business Object

  5. In the Business Object editor, create the following Business Object structure, with the message as one attribute of type String (see Figure 6).

    Figure 6. Business Object structure
    Business Object structure

  6. In the Tibco_Library, right-click the Interfaces to create a new Interface called TibcoMessageIntf.

    Figure 7. TibcoMessageIntf Interface
    TibcoMessageIntf Interface

  7. In the Interface editor, create a one-way Interface operation called ReceiveMessage.

    Figure 8. Interface operation
    Interface operation

  8. Create two inputs namely, req1 and req2 for the operation ReceiveMessage. Set data types of both inputs as TibcoMessage.

    Figure 9. Data types
    Data types

  9. From the Business Integration tab, choose New => Module to create a module called ReceiveTibcoMessage.

    Figure 10. Creating a module
    Creating a module

  10. In the module Name field, type in ReceiveTibcoMessage, and then click Finish.

    Figure 11. Naming the module
    Naming the module

  11. Select Tibco_Library as Required Libraries and click Finish.

    Figure 12. New module
    New module

  12. In the ReceiveTibcoMessage module, right-click the Processes under Business Logic to create a business process called TibcoMessageBP.

    Figure 13. TibcoMessageBP module
    module

  13. In the Select the interface dialog box, select the interface called TibcoMessageIntf, then click Finish.

    Figure 14. TibcoMessageIntf module
    TibcoMessageIntf module

  14. In the Business process editor, select the snippet from the left palette to create a snippet called Printing Tibco EMS Message.

    Figure 15. Create a snippet
    Create a snippet

  15. In the snippet editor, click the standard Java utility to open the box for selecting the "print to log" utility.

    Figure 16. Add a snippet
    Add a snippet

  16. In the snippet editor, drag the input variable Req1 on the right-hand side and choose the required element (message).

    Figure 18. Snippet: Choosing the required element
    Snippet: Choosing the required element

  17. The final snippet looks like Figure 19.

    Figure 19. Final snippet
    Final snippet

  18. In the Assembly editor, drag the business process.

    Figure 20. Assembly Diagram
    Assembly Diagram

  19. In the Assembly editior, right-click the business process and generate the JMS export by selecting Generate Export => Messaging Binding => JMS Binding.

    Figure 21. Generate the JMS Export
    Generate the Export

  20. In the Configure JMS Export Service dialog box, type in jms/tibcowpsq for the Receive destination and eis/tibcowpsas as the Activation spec JNDI name. Use Business Object XML using JMSTextMessage as Databinding.

    Figure 22. Configuring the export
    Configuring the export

  21. Check out the final assembly diagram in Figure 23 below:

    Figure 23. Final Assembly Diagram
    Assembly diagram

Creating the TIBCO EMS Message Producer

The TIBCO Message producer is a session bean that will put message into TIBCO EMS queue. This requires creation of Session bean.

  1. In WebSphere Integration Developer, switch to the J2EE perspective.
  2. From the J2EE perspective, create a new EJB project.

    Figure 24. Create a new EJB project
    Create a new EJB project

  3. In the EJB project Name field, type in TibcoEMSMessageProducer and then click Next.

    Figure 25. Naming the EJB project
    Naming the EJB project

  4. Click Finish.

    Figure 26. The new EJB project
    The new EJB project

  5. Expand the EJB project and right-click Session Bean, then create a New Session Bean.

    Figure 27. Creating a new Session Bean
    Creating a new Session Bean

  6. In the Session Bean Name field, type in TibcoEMSMessageSender.

    Figure 28. Naming the Session Bean
    Naming the Session Bean

  7. Double-click the TibcoEMSMessageSenderBean. Create a method called publishMessage. Place the following code there:

    Listing 1. Session Bean's publishMessage method
                            
    	public void publishMessage(String messageString) throws Exception {
    		try {
    			
    			System.out.println("Sending Message to TIBCO EMS Queue...");
    			InitialContext context = new InitialContext();
    			ConnectionFactory cf = (ConnectionFactory) context.lookup(SEND_CF);
    			Destination dest = (Destination) context.lookup(SEND_DEST);
    			Connection conn = cf.createConnection();
    			Session jmsSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
    			MessageProducer producer = jmsSession.createProducer(dest);
    			TextMessage message = jmsSession.createTextMessage();
    			message.setText(messageString);
    			producer.send(message);
    			producer.close();
    			jmsSession.close();
    			conn.close();
    		} catch (Exception e) {
    			
    			System.out.println("Error in publish message SLSB");
    			mySessionCtx.setRollbackOnly();
    			throw e;
    		}
    
    						  


    The above code is also there in the attached project interchange file, namely; TibcoMessageProducerAndReceiver.zip

Configuring the Resource references

Resource references needs to be configured on TibcoEMSMessageProducer bean (for it to put message on TIBCO EMS queue).

  1. Double-click the Deployment Descriptor for TibcoEMSMessageProducer bean.

    Figure 29. Deployment Descriptor
    Deployment Descriptor

  2. Click the References tab. Select the bean and click Add.

    Figure 30. Add References
    Add References

  3. On the Add Reference box, select Resource reference, and click Next.

    Figure 31. Add Reference
    Add Reference

  4. Type jms/TibcoConnectionFactoryRef as Name and Type as javax.jms.Connectionfactory. Select Shareable as connection. Click Finish.

    Figure 32. Connectionfactory
    Connectionfactory

  5. Enter jms/ConnectionFactory as the jndi name.

    Figure 33. Naming the Connectionfactory
    Naming the Connectionfactory

  6. Create message destination reference for the jms queue.

    Figure 34. Creating a destination reference
    Creating a destination reference

  7. Select the type as javax.jms.Queue and Usage as producers.

    Figure 35. Queue
    Queue

  8. Type jms/Q1 in the JNDI name under the WebSphere Binding tab and click Save.

    Figure 36. JNDI name
    JNDI name

Creating the TIBCO Message Receiver Message Drive Bean (MDB)

The TIBCO Message Receiver MDB will receive a message from TIBCO EMS and then send it to Process Server (business process). Hence, it is required to create the MDB with required Resource references as mentioned in steps below.

  1. In WebSphere Integration Developer, switch to the J2EE perspective.
  2. From the J2EE perspective, create a new EJB project called TibcoEMSMessageReceive.

    Figure 37. Create the EJB project
    Create the EJB project

  3. Create the Message Driven Bean and name it TIBCOListener.

    Figure 38. Create the Message Driven Bean
    Create the Message Driven Bean

  4. Open the Deployment Descriptor of the MDB. Click the Bean Tab and navigate to WebSphere Bindings. On the listener port, type TIBCOListenerPort that we created.

    Figure 39. Message Driven Bean listener port
     Message Driven Bean listener port

  5. Go to the References tab. Create following Resource references:

    Resource references setting in deployment descriptor
    Reference NameTypeJNDI Name
    jms/MyConnectionFactoryRefjavax.jms.QueueConnectionFactoryjms/MyConnectionFactory
    jms/TibcoConnectionFactoryRefJavax.jms.ConnectionFactoryjms/TibcoConnectionFactory
    jms/DestinationRefjavax.jms.Queuejms/tibcowpsq




    Figure 40. Resource references
     Resource references

  6. Open the TIBCOListenerBean.java class. Create the sendToBusinessProcess method:

    Listing 2. TIBCOListenerBean
                            
    public void sendToBusinessProcess(String msg) throws Exception {
    		
    	InitialContext initCtx = new InitialContext();
    	
        // Finding the WAS QueueConnectionFactory
        javax.jms.ConnectionFactory qcf = 
    	(javax.jms.ConnectionFactory) initCtx.lookup(SEND_CF);
    
        // Finding the Queue Destination
        Destination q = (Destination) initCtx.lookup(SEND_DEST);
    
        // Create JMS Connection
        Connection connection = qcf.createConnection();
    
        // Create JMS Session
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    
        // Create MessageProducer and TextMessage
        MessageProducer queueSender = session.createProducer(q);
        TextMessage outMessage = session.createTextMessage();
        outMessage.setText(messageText1+msg+messageText2+messageText3+msg+messageText4);
    
        // set target operation name for WESB default JMS function selector
        outMessage.setStringProperty("TargetFunctionName", "ReceiveMessage");
    	
        // Set type and destination and send
        outMessage.setJMSType("ReceiveMessage");
        outMessage.setJMSDestination(q);
        queueSender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
        queueSender.send(outMessage);
        
        connection.close();    
        System.out.println("Send completed");
    		
    	}
    				

    The class can be found in following project Interchange file: TibcoMessageProducerAndReceiver.zip.

Building and running the sample

Go to the Project tab in WebSphere Integration Developer and do a Clean on all projects, then do a Build All. Next, follow these steps:

  1. Start the TIBCO EMS server.

    Figure 41. TIBCO EMS server
     TIBCO EMS server

  2. Start WebSphere Process Server. After the server is started, from the server tab, right-click the server and add TibcoEMSMessageReceive, TibcoEMSMessageProducer, and ReceiveTibcoMessage projects to the Server.

    Figure 42. Add the project
     Add the project

  3. Click Finish.

    Figure 43. Console
     Console

  4. Now switch to the J2EE perspective. Go to TibcoageProducer project and right-click the TibcoMessageSender bean and choose Run => Run on server.

    Figure 44.Test Client: Running TibcoMessageSender bean on the server
    Test Client: Running TibcoMessage on the server

  5. The Universal Test Client opens.

    Figure 45.Test Client
    Test Client

  6. Click TibcoEMSMessageSender create(). Click Invoke and then click Work with object.

    Figure 46.TibcoEMSMessageSender
    TibcoEMSMessageSender

  7. The new object will be created. Click publishMessage method, then enter the message that we sent to TIBCO EMS.

    Figure 47. New TibcoEMSMessageSender object
    New TibcoEMSMessageSender object

  8. The session bean sends the message to TIBCO EMS Queue. The TIBCO Listener MDB picks up the message and sends it to Process Server queue. The business process picks up the message from Process Server queue.

    Figure 48.Output on Console
    Output

Limitations

Presently JMS binding in Process Server has some limitations. The Business Object XML using JMS TextMessage serialization type can only serialize business objects; that is, an interface operation must have its input(s) and output(s) defined as a business object type. Secondly, the business process receiving the JMS message should have interface operation with more than one input.

Conclusion

This article described the steps for configuring EMS and Process Server. It showed you how to pass the message coming from an EMS messaging system to a business process in WebSphere Process Server, how to write an EJB (MDB) to put a message on a queue, how to create a business process, and how to print the TIBCO EMS message received from the WebSphere Process Server.
In this article, you learned how easy it is to connect EMS to WebSphere Process Server and how businesses that are looking forward to using WebSphere Process Server can connect easily with their existing EMS messaging system.



Downloads

DescriptionNameSizeDownload method
Project Interchange of Business ProcessReceiveTibcoMessagePI.zip20KBHTTP
Project Interchange of message producer/listernerTibcoMessageProducerAndReceiver.zip17KBHTTP

Information about download methods          Get Adobe® Reader®


Resources

Learn

Get products and technologies

About the author

Photo of Abhay Srivastava

Abhay Srivastava is a Senior Software Engineer working on IBM WebSphere Process Server. His focus area is around BPEL business processes, Web services, Common Event Infrastructure, ws-security and mediation primitives. He is an engineering graduate from the Indian Institute of Technology, Madras. You can reach him at abhay_iitm@yahoo.com.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=226323
ArticleTitle=Integrating business processes with TIBCO Enterprise Message Service and WebSphere Process Server
publish-date=06202007
author1-email=abhay_iitm@yahoo.com
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.

Special offers