Setting up the Message Routing sample

Message Routing by using a database

To run the Message Routing sample by using a database you require a database with a table that is populated with sample data as part of the setup. An ODBC definition for the database is also required and the broker must be configured with a user identifier and password to use when accessing the database.

Complete the following tasks to set up the database environment:

  1. Create the database and ODBC definition.

    Follow the instructions that are relevant to your database manager:

  2. Specify the user identifier and password that are associated with the data source name ROUTING.

    Use the mqsisetdbparms command to specify a user identifier and password for the broker to use with the ROUTING data source. This user identifier must be the same user identifier that you used when you created the database in the previous step. The user identifier determines the database schema name and the broker must use the same user identifier when accessing the table. For example, if your user identifier is USERID, the fully qualified name of the ROUTING_TABLE table name is USERID.ROUTING_TABLE.

    1. Open a command console window in which you can run WebSphere Message Broker commands. Enter the following command to specify the user identifier and password:
      mqsisetdbparms MB8BROKER -n ROUTING -u <user ID> -p <password>
    2. If the MessageRoutingSampleUsingDatabase execution group exists, enter the following command to reload it:
      mqsireload MB8BROKER -e MessageRoutingSampleUsingDatabase

Message Routing by using a file

When you configure a FileRead node, you must set the directory from which you want to read files. You can set either an absolute path or a relative path. If you set a relative path, you must set the directory root for the broker. You can set the directory root by setting the environment variable MQSI_FILENODES_ROOT_DIRECTORY.

To run this sample, set the environment variable as follows:

The rest of this documentation assumes that you have set the environment variable as specified.

To set up the Message Routing Sample by using a file:

  1. Create the following directory:
  2. Ensure that your default broker has been created and is running.
  3. Set the MQSI_FILENODES_ROOT_DIRECTORY environment variable to the root directory.
    1. Follow the instructions at Setting up a command environment to create a command environment and a command file that contains the following line (ensuring that there is no white space around the equal (=) sign):
      • On Windows:
        SET MQSI_FILENODES_ROOT_DIRECTORY=c:\MQSIFileRead
      • On Linux:
        export MQSI_FILENODES_ROOT_DIRECTORY="/tmp/MQSIFileRead"
    2. Stop and restart your broker. See Starting and stopping a broker.
  4. Save the following files to either:c:\MQSIFileRead\routingDir on Windows or /tmp/MQSIFileRead/routingDir on Linux. Alternatively, when the sample project has been imported into the workspace, expand the FileRead files directory and save the files to the MQSI_FILENODES_ROOT_DIRECTORY directory.

Back to sample home