Sample scenario 2: Re-routing business objects

Sample scenario 2 demonstrate how to use the DynamicMetaObject to re-route the BO to various queues defined in WebSphere MQ.

Summary

In this scenario we will create an attribute for a child meta object in our Sample_WebSphereMQ_LegacyContact. When we send business objects to the WBI Adapter for WebSphere MQ, we will modify the outputQueue values in this child meta object to redirect the Sample_WebSphereMQ_LegacyContact business object to various queues of our choice.

Assumptions

Before you can install and run the sample scenario, you must meet the following requirements:

Installing the dynamic meta object sample scenario

The following steps describe how to install the dynamic meta object sample scenario.

Important:
You must install Sample Scenario 1 before installing Sample Scenario 2.

  1. Add application-specific information to identify the attribute containing the dynamic meta object.

    In the Sample_WebSphereMQ_LegacyContact business object, add the following entry to the business object level application-specific information: "cw_mo_conn=DynMO". This identifies the attribute.
  2. Add the actual attribute to the parent object. The following steps describe how to do this.
    1. Using WebSphere Business Integration System Manager open the following objects:
      • Sample_WebSphereMQ_DynMO_Config.xsd
      • Sample_WebSphereMQ_LegacyContact.xsd
    2. In the Sample_WebSphereMQ_LegacyContact Object window, add an attribute named "DynMO" of type 'Sample_WebSphereMQ_DynMO_Config'.
  3. Define a new target queue.

    Define a temporary queue "REROUTE.IN" in WebSphere MQ. This is where we will re-route our Sample_WebSphereMQ_LegacyContact business object. To create the necessary queue, type "RUNMQSC crossworlds.queue.manager" from the command line, and then issue the following command:

    DEFINE QL('REROUTE.IN')

Running the dynamic meta object sample scenario

The following steps describe how to run the dynamic meta object sample scenario.

  1. Start the WBI Adapter for WebSphere MQ if it is not already running.
  2. Start the Visual Test Connector if it is not already running.
  3. Simulate the port connector. The following steps describe how to do this.
    1. Using the VTC, define a profile for "PortConnector." The following steps describe how to do this.
      1. From the VTC menu, select File > Create/Select Profile.
      2. Select File > New Profile from the Connector Profile menu.
      3. Select the Port Connector Configuration File "PortConnector.cfg" in the %SAMPLES% directory.
      4. Configure the 'Connector Name' and 'Broker Type' and select 'OK.'
      5. Select the profile you created, and then select 'OK.'
    2. Select File > Connect to begin simulating the connector agent.
  4. Create an instance of a parent business object and a child meta object.

    Using the Test Connector, create a new instance of business object "Sample_WebSphereMQ_LegacyContact". Change the default values if desired. Also Create an instance of Sample_WebSphereMQ_DynMO_Config by right-clicking on the DynMO attribute and creating and instance of it.
  5. Set the new target queue (REROUT.IN)

    Expand the DynMO attribute by clicking on the + sign beside it. In the attribute named outputQueue, enter the name of the queue you want the BO to go to. In our case it would be the new "REROUTE.IN" queue. Make sure you enter the complete URI, as follows:

    queue://<queue manager>/REROUTE.IN?targetClient=1.
  6. Send the business object.
  7. Check that a message was delivered.

    Using WebSphere MQ Explorer or another similar application, open queue "queue://<queue manager>/REROUTE.IN" to see if a new contact message has arrived from the adapter.

When you are finished

If a new message has arrived from the adapter into the queue named REROUTE.IN, then the re-routing has worked. Now you can create different queues in WebSphere MQ and send in the business objects with different queue names in their dynamic meta objects.

Copyright IBM Corporation 2003, 2005. All Rights Reserved.