Running the scenarios
Before you run the scenarios:
- Start the adapter for WebSphere MQ if
it is not already running.
- Start the Visual Test connector if it
is not already running.
Static meta-object scenario
This part of the tutorial describes a scenario using a
static meta-object. For further information on static meta-objects,
see Overview of creating static meta-objects.
- Simulate the Port connector Using the
Visual Test connector, define a profile for the Port connector:
- Select File->Create/Select Profile from
the Visual Test connector menu, then select File-> New Profile from
the Connector Profile menu.
- Select the Port Connector configuration file PortConnector.cfg in the sample_folder, then configure
the Connector Name and Broker Type and click OK.
- Select the profile you created and click OK.
- From the Visual Test connector menu, select File->Connect to
begin simulating.
- Test request processing
- Using the Test Connector, create a new instance of business
object Sample_WebSphereMQ_LegacyContactby selecting the business object in the BoType drop-down
box and then selecting Create for the BOInstance.
- Change the default values if desired, set the verb to Create and
send the message by clicking Send BO.
- Check message delivery Using WebSphere
MQ Explorer or a similar application, open queue queue://crossworlds.queue.manager/LEGACYAPP.IN to see if a new contact message with format LC_CR has arrived from the adapter.
- Test event processing Send a message to
the WebSphere MQ adapter's input queue. Note: this step
requires that you have a utility capable of sending messages to
a queue. Otherwise, to implement an easier approach, you can set
the WebSphere adapter's InputQueue property to queue://crossworlds.queue.manager/LEGACYAPP.IN so that the adapter will poll its own messages. Once you
have a message in the input queue, the adapter will poll it and
attempt to convert it into a Sample_WebSphereMQ_LegacyContact business object. The key to having the adapter poll the message
is to ensure that the message format equals the value associated
with the Sample_WebSphereMQ_LegacyContact business object in meta-object Sample_WebSphereMQ_MO_Config. In this scenario, that format is LC_CR. If the adapter identifies the incoming message format as LC_CR, it will use the data handler to convert the message to business
object Sample_WebSphereMQ_LegacyContact with the verb Create. The newly created business object is subsequently delivered
to the to the Test connector.
- Confirm message delivery If you've performed
all the above steps successfully, you should have a working scenario
that enables the WebSphere MQ adapter to retrieve messages and convert
them to Sample_WebSphereMQ_LegacyContact business objects, and to convert Sample_WebSphereMQ_LegacyContact business objects to contact messages.
Dynamic meta-object scenario
This scenario demonstrates how to use a dynamic meta-object
to re-route a business object to various queues defined in the static
meta-object scenario. For further information on dynamic meta-objects,
see Overview of creating dynamic child meta-objects. For prerequisites for
this scenario, see Before you begin.
In addition, you must install and configure the Port connector as
described in Static meta-object scenario. The steps
below take you through creating an attribute for a child meta-object
for Sample_WebSphereMQ_LegacyContact. Specifically, you will be modifying the output queue values
in this child meta object to redirect the Sample_WebSphereMQ_LegacyContact business object to a new queue.
- Identify the dynamic meta-object attribute First
you must add application-specific information to identify the attribute
containing the dynamic meta-object: in Sample_WebSphereMQ_LegacyContact, add cw_mo_conn=DynMO to the application-specific information. This identifies
the attribute.
- Add the attribute Using Business Object
Designer:
- Open Sample_WebSphereMQ_DynMO_Config.xsd and Sample_WebSphereMQ_LegacyContact.xsd from the sample_folder.
- In the Sample_WebSphereMQ_LegacyContact 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 the dynamic meta-object will
re-route the Sample_WebSphereMQ_LegacyContact business object. To create the necessary queue, type RUNMQSC crossworlds.queue.manager from the command line and issue the following command: DEFINE QL('REROUTE.IN')
- Start the 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 (If you have
already performed this step for the static meta-object scenario,
skip this task and go to the next step.) Using the Visual Test connector,
define a profile for the Port connector:
- Select File->Create/Select Profile from
the Visual Test connector menu, then select File-> New Profile from
the Connector Profile menu.
- Select the Port Connector configuration file PortConnector.cfg in the Samples directory, then configure the Connector Name and Broker Type
and click OK.
- Select the profile you created and click OK.
- From the Visual Test connector menu, select File->Connect to
begin simulating.
- Create instances of parent business object and child meta object Using
the Visual Test Connector:
- Create a new instance of business object Sample_WebSphereMQ_LegacyContact, changing the default values if desired.
- Right-click on the DynMO attribute and create an instance of it, Sample_WebSphereMQ_DynMO_Config.
- Set the new target queue
- Expand the DynMO attribute by clicking on the + sign
beside it.
- In the attribute named outputQueue enter the name of the target queue. For this scenario, the
target queue is REROUTE.IN. Make sure you enter the complete URI, for example, queue://<queue manager>/REROUTE.IN?targetClient=1.
- Send the business object Click Send BO.
- Confirm message delivery Using WebSphere
MQ Explorer or a similar application, open queue queue://<queue manager>/REROUTE.IN to see if a new contact message has arrived from the adapter.
If a new message has arrived from the WebSphere MQ adapter to the
queue named REROUTE.IN, then the re-routing has worked. You can create different queues
in WebSphere MQ and send the business objects with different queue names
in their respective dynamic meta-objects.
