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:
- You have installed and are experienced with the WebSphere ICS
4.2.x product or later.
- You have installed and are experienced with IBM WebSphere MQ
5.1 or higher.
- You have installed the WebSphere MQ client libraries for Java.
- You have installed the WBI Adapter for WebSphere MQ.
- Your WebSphere MQ queue manager is named "crossworlds.queue.manager" (the
default value during installation). If your queue manager is named otherwise,
substitute your queue manager name whenever this document refers to
"crossworlds.queue.manager".
- You have set up the WebSphere MQ adapter and PortConnector,
and you have loaded all the sample collaborations and sample objects
as described in the section Installing and configuring the sample scenario.
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.
- 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.
- Add the actual attribute to the parent object. The following
steps describe how to do this.
- Using WebSphere Business Integration System Manager open the
following objects:
- Sample_WebSphereMQ_DynMO_Config.xsd
- Sample_WebSphereMQ_LegacyContact.xsd
- In the Sample_WebSphereMQ_LegacyContact Object window, add an attribute
named "DynMO" of type 'Sample_WebSphereMQ_DynMO_Config'.
- 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.
- Start the WBI Adapter for WebSphere MQ if it is not already
running.
- Start the Visual Test Connector if it is not already running.
- Simulate the port connector. The following steps describe how
to do this.
- Using the VTC, define a profile for "PortConnector." The following
steps describe how to do this.
- From the VTC menu, select File > Create/Select Profile.
- Select File > New Profile from the Connector Profile
menu.
- Select the Port Connector Configuration File "PortConnector.cfg"
in the %SAMPLES% directory.
- Configure the 'Connector Name' and 'Broker Type' and select
'OK.'
- Select the profile you created, and then select 'OK.'
- Select File > Connect to begin simulating the connector
agent.
- 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.
- 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.
- Send the business object.
- 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.
