Setting up the Error Handler sample
When you have imported the Error Handler sample, you must configure
the sample to use transactionality before you can deploy the sample to
the
broker.
To set up the Error Handler sample to use transactionality:
- Set up ODBC (Linux only)
- Enable transactionality with DB2 (Windows and Linux)
- Enable transactionality in WebSphere MQ (Windows and Linux):
- Deploy the sample to the broker (Windows and Linux)
Setting up the ODBC drivers on Linux
This step must be performed on Linux but not on Windows. So skip this step if you are working only on Windows.
To set up the ODBC drivers on Linux:
- Open the /var/mqsi/odbc/.odbc.ini file in a text editor.
- In the .odbc.ini file, locate the line that says: [ODBC Data Source] then insert the following lines below it:
ERRORDB= IBM DB2 ODBC Driver
STAFFDB= IBM DB2 ODBC Driver
- Add the following stanzas to the .odbc.ini file:
[ERRORDB]
Driver=/opt/IBM/db2/V8.1/lib/libdb2.so
Description=ERRORDB DB2 ODBC Database
Database=ERRORDB
[STAFFDB]
Driver=/opt/IBM/db2/V8.1/lib/libdb2.so
Description=STAFFDB DB2 ODBC Database
Database=STAFFDB
The ODBC drivers are now configured correctly.
Enabling transactionality with DB2
To configure DB2 to use transactionality:
- Start the DB2 Control Center:
- On Windows, click Start >
Programs > IBM DB2 > General Administration Tools > Control
Center
- On Linux, on the command line, type db2cc
- In the navigation tree, where hostname is the name
of your computer and DB2 is the name of the database
instance, expand All Systems > computername
> Instances > DB2. On Windows, DB2
is typically DB2; on Linux, DB2
is typically db2inst1.
- Right-click DB2,
then click Configure Parameters... The
DBM Configuration dialog opens.
- In the DBM Configuration dialog, scroll down the dialog to
the Environment section. In the Keyword
column, click TP_MON_NAME.
- For TP_MON_NAME, click the cell in the Value column, then
click the ellipses (...) in the same
cell. The Change DBM Configuration Parameter dialog opens.
- In the Change DBM Configuration Parameter dialog, from the Transaction processor monitor name list,
click IBM MQSeries, then click OK.
- Click OK to close the DBM
Configuration dialog. A message is displayed prompting you to restart
DB2: click Close to close the message.
- In the navigation tree, right-click DB2,
then click Stop.
A dialog prompts you to confirm that you want to stop DB2 and
disconnect all applications that are currently accessing a DB2
database. Click OK to continue, then
wait for DB2 to stop.
- In the navigation tree, right-click DB2,
then click Start,
then wait for DB2 to start again.
Enabling transactionality in WebSphere MQ Version 6.0
Define the STAFFDB database as an XA resource manager to the broker's queue manager. The broker's queue manager acts as the transaction manager. The steps to configure the queue manager are different than if you use WebSphere MQ Version 5.3.
To define the STAFFDB database as an XA resource manager:
- Copy the DB2 switch file from the WebSphere Message Broker installation to the WebSphere MQ V6.0 installation:
- On Windows, copy the db2swit.dll file from install_dir\sample\xatm to mq_install_dir\exits where install_dir is the path to where WebSphere Message Broker is installed, and mq_install_dir is the path to where WebSphere MQ V6.0 is
installed.
- On Linux, copy the db2swit file from install_dir/sample/xatm to /var/mqm/exits where install_dir is the path to where WebSphere Message Broker is installed.
DB2 must be installed in its default location for the DB2 switch file to work correctly.
- Configure the broker's queue manager, WBRK61_DEFAULT_QUEUE_MANAGER, to add a new resource manager, STAFFDB:
- Start WebSphere MQ Explorer:
- On Windows, click Start > Programs > IBM WebSphere MQ > WebSphere MQ Explorer.
- On Linux, on the command line, type: strmqcfg
- In the Navigator view of WebSphere MQ Explorer, expand the tree to display the broker's queue manager, WBRK61_DEFAULT_QUEUE_MANAGER.
- Right-click WBRK61_DEFAULT_QUEUE_MANAGER, then click Properties... The queue manager's Properties dialog opens.
- On the XA resource managers page, click Add..., then enter the details in the following table.
Field name |
Value |
Name |
DB2 Error Handler |
Switch file |
db2swit |
XAOpenString |
STAFFDB,userid,password,toc=t
where userid is your WebSphere Message Broker user name, and password is the associated password. |
XACloseString
|
DB2 does not require an XA close string. |
Thread of Control |
From the list, click Thread. |
- Stop and start the broker's queue manager. In WebSphere MQ Explorer, right-click WBRK61_DEFAULT_QUEUE_MANAGER, then click Stop; right-clickWBRK61_DEFAULT_QUEUE_MANAGER, then click Start. Ensure that the queue manager started without errors.
The STAFFDB database is defined as the XA resource manager to the broker's queue manager, WBRK61_DEFAULT_QUEUE_MANAGER.
Enabling transactionality in WebSphere MQ Version 5.3
Define the STAFFDB database as an XA resource manager to the broker's queue manager. The broker's queue manager acts as the transaction manager. The steps to configure the queue manager are different than if you use WebSphere MQ Version 6.0. Also, in WebSphere MQ Version 5.3, there is no graphical equivalent of WebSphere MQ Explorer, so you must directly edit the queue managers ini file, as described in the following instructions.
To define the STAFFDB database as an XA resource manager:
- Copy the DB2 switch file from the WebSphere Message Broker installation to the WebSphere MQ V5.3 installation:
- On Windows, copy the db2swit.dll file from install_dir\sample\xatm to mq_install_dir\exits where install_dir is the path to where WebSphere Message Broker is installed, and mq_install_dir is the path to where WebSphere MQ V6.0 is installed.
- On Linux, copy the db2swit file from install_dir/sample/xatm to /var/mqm/exits where install_dir is the path to where WebSphere Message Broker is installed.
DB2 must be installed in its default location for the DB2 switch file to work correctly.
- Configure the broker's queue manager, WBRK61_DEFAULT_QUEUE_MANAGER, to add a new resource manager, STAFFDB:
- On Windows:
- Start the WebSphere MQ Services snap-in: Start > Programs > IBM WebSphere MQ > WebSphere MQ Services
- In the Navigator view of WebSphere MQ Explorer, expand the tree to display the broker's queue manager, WBRK61_DEFAULT_QUEUE_MANAGER.
- Right-click WBRK61_DEFAULT_QUEUE_MANAGER, then click Properties... The queue manager's Properties dialog opens.
- On the Resources page, click New, then enter the details in the following table.
Field name |
Value |
Name |
DB2 Error Handler |
Switch file |
install_dir\sample\xatm\db2swit.dll
where install_dir is the directory in which WebSphere MQ V5.3 is installed. |
XAOpenString
|
STAFFDB,userid,password
where userid is your WebSphere Message Broker user name, and password is the associated password. |
XACloseString
|
DB2 does not require an XA close string. |
Thread of Control |
For DB2 versions prior to V8 select Process, otherwise select Thread. |
- Stop and start the broker's queue manager. In WebSphere MQ Services, right-click WBRK61_DEFAULT_QUEUE_MANAGER, then click Stop; right-clickWBRK61_DEFAULT_QUEUE_MANAGER, then click Start. Ensure that the queue manager started without errors.
- On Linux:
- Open the /var/mqm/mqs.ini file to edit it and add the following stanza:
XAResourceManager:
Name=DB2 Error Handler
SwitchFile=install_dir/sample/xatm/db2swit
XAOpenString=STAFFDB,userid,password
ThreadOfControl=PROCESS | THREAD
where install_dir is the path to where WebSphere Message Broker is installed, and if the DB2 version is prior to V8 type PROCESS, otherwise type THREAD.
- Stop and start the broker's queue manager.
The STAFFDB database is defined as the XA resource manager to the broker's queue manager, WBRK61_DEFAULT_QUEUE_MANAGER.
Deploying
the Error Handler sample to
the broker
- In the Message Brokers Toolkit, switch to the Broker
Administration perspective.
- Create a new broker archive (bar) file and add Main_Flow.msgflow to the bar file:
- In the Broker Administration perspective, click File > New > Message Broker Archive. The New
Message Broker Archive wizard opens.
- In the New Message Broker Archive wizard, select the
server project and enter a name for the bar file, then click Finish. The new bar file is created and opens
in the Broker Archive editor.
- In the Broker Archive editor, click the Add
button. The Add to Broker Archive dialog opens.
- In the Add to Broker Archive dialog, click the Error Handler Message Flows project, then
select Main_Flow.msgflow. Click OK. The Main_Flow.msgflow file is added to
the bar file.
- Configure the message flow to run as a coordinated transaction:
- Click the Configure tab at the bottom of the Broker Archive editor to switch to the Configure page.
- Click Main_Flow.cmf to highlight it.
- Select the Coordinated Transaction check box.
- Click the Content tab to return to the main page in the editor.
- Press Ctrl+S to save the bar
file.
- Ensure that the Message Brokers Toolkit is connected to the
Configuration Manager.
- In the Domains view, create a new execution group called ErrorHandler.
- In the Broker Administration Navigator, right-click the bar
file that you created, then click Deploy
File... The Deploy a BAR File dialog opens.
- In the Deploy a BAR File dialog, click the ErrorHandler execution group, then click OK. The Main_Flow.msgflow file is deployed to
the broker.
You can now run the Error Handler sample. See Running
the sample.
Back to sample home