Simple Message flow with WebSphere Message Broker
The following list of software’s are required to start of with Message Broker development,
- IBM WebSphere MQ.
- IBM WebSphere Message Broker.
- IBM WebSphere Message Broker Toolkit.
- IBM DB2 or any RDBMS.
The Message Broker Toolkit is an application development and administration IDE (Eclipse), the Message broker(Set of application processes) hosts and executes the message flows and the Configuration Manager acts as an interface between the Message Broker Toolkit and the Message Brokers. The configuration manager is responsible for deploying message flows to the brokers and also manages the configurations in an internal repository.
2. Create Configuration Manager
To create a configuration manager Run command prompt and enter the following command,
mqsicreateconfigmgr configMgrName -i serviceUserId -a servicePassword -q queueManagerName [-n db2DatabaseToMigrate -u migrationDatabaseUserId -p migrationDatabasePassword] [-s unsQMgrName] [-w workPath]
For Example:- mqsicreateconfigmgr SRIConfigMgr -i MQSIUSER -a MQSIPASS -q CMQM
Note:- On Windows platforms, if the Configuration Manager name is omitted ‘ConfigMgr’ will be used.
3. Create Database
From Start Menu Programs select IBM DB2 -> Command Line Tools -> Command Line Processor
create database BK1 – Each broker requires a database for its operation.
4. Create Broker
From Administrative Tools -> Data Source (ODBC) -> Create a System DSN -> BK1 (DSN Name), Select IBM DB2 ODBC Driver if you are using DB2.
mqsicreatebroker brokerName -i serviceUserId -a servicePassword -q queueManager
Name -n dataSourceName [-u dataSourceUserId] [-p dataSourcePassword] [-s unsQMgr
Name [-j]] [-g configurationTimeout] [-k configurationDelayTimeout] [-w workPath
] [-l userLilPath] [-t] [-m] [-v statisticsMajorInterval] [-P httpListenerPort]
[-c icuConverterPath] [-y ldapPrincipal -z ldapCredentials] [-x userExitPath]
For Example:- mqsicreatebroker BK1 -i MQSIUSER -a MQSIPASS -q CMQM -n BK1
Note:- The queue manager used by configuration manager can be shared with one broker. If the qmgr that you specify on the create command (via -q flag) doesn’t already exist, the command will create one for you. If it does exist, then it will use that qmgr.
5. Start Configuration Manager and Broker
mqsistart SRIConfigMgr -> Configmanger Name
mqsistart BK1 -> Broker Name.
Note:- mqsilist command can be used to list the configuration managers and the brokers.
6. Create Queues and Listener
From the Websphere MQ Explorer do the following,
- Create IN queue[Input Queue] and OUT queue[Output Queue].
- Create a Listener L1 on port 6667.
- Right click and Start the Listener.
7. Create Message Flow Project
- Open WebSphere Message Brokers Toolkit and switch to Broker Administration Perspective.
- From the Domains pane right click and select New -> Domain Connection.
- Enter the Queue Manager Name as CMQM and port as 6667 and click on Next to connect.
- If connected enter the desired connection name and click on finish.
- Right click on Broker Topology and select New -> Broker Reference.
- Enter the broker name as BK1 and the queue manager name as CMQM and click on Finish.
- For the question, which type of deploy do you want to perform? select complete. This should create a Broker reference and a default execution group.
- Switch to Broker Application Development Perspective.
- From the File menu select New -> Message Flow Project.
- Enter the desired project name and click on finish.
- Right click on Flows under the newly created message flow project.
- Select New -> Message Flow and enter the name as SimpleMessageFlow and click on Finish.
- Create the flow in the designer.
- Enter the Queue Name for MQInput Node as “IN” and Queue Name for MQOutput Node as “OUT” under properties.
- Switch to Broker Administration Perspective.
- Right click on Broker Archives and select New -> Message Broker Archive.
- Select the project name and enter the desired name for the archive and click on Finish.
- From the Archive configuration select the message flow and click on “Build broker archive” button.
- Save and deploy to the broker’s default execution group [Right click on the archive and select deploy File].
- Right click on the default execution group and select properties and enter the desired JVM Debug Port  and click on Ok.
- Switch to Debug Perspective and click on the Debug icon -> Select Message Boker Debug.
- Under New_Configuration enter the port as 9998 and click on Select Execution Group and select the execution group and click on ok.
- Click on Apply and Click on Debug to start debugging.
- Put a message in the “IN” queue and the message will flow through the message flow and delivered to the “OUT” queue.
Note:- The JVM Debug Port specified flow engines [Execution group] and the Java debug port specified in the Message Broker Debug config should be same.
mqsichangeproperties <broker-name> -e <execution-group-name> -o ComIbmJVMManager -n jvmDebugPort -v <port-number>