Adding monitoring to your flows for record and replay
In this section, you create a simple application containing a flow, then add monitoring events to the flow, which are picked up by the default execution group and stored in the
datacapturestore database that you just defined and connected to MB8BROKER.
- Create a new application using the Message Broker Toolkit:
- Create your TestFlow flow:
Here is a simple flow: MQInput Node (Queue Name=INQ) => PassThrough Node => MQOutput Node (Queue Name=OUTQ), with the Catch and Failure terminals connected to an MQOutput Node (Queue Name=FAILQ):
- Now you have a simple flow and can add monitoring events to it. You want an audit event to fire whenever the message leaves the Out terminal of the INQ, and an exception message to fire whenever the message goes down the Catch terminal to the FAILQ. Click on the INQ node to select the Monitoring tab in the Properties and then click Add.
- Select the Event Source as Out Terminal and tick Include bitstream in payload to include the bitstream in the event message, so that the broker emits an event every time a message goes out of this terminal and attaches the bitstream, which the recording broker can listen for and then place into the broker's record and replay database:
- For the failure case you want to add another monitoring event, but this time select the source as Catch Terminal, add in the data location as $ExceptionList, and include the bitstream as before. Any exception information will also be sent to the record and replay database and can be viewed there. At present the broker only records bitstreams and ExceptionLists, and any other environment properties set there are ignored:
- Check that your monitoring has been correctly set up by looking at your flow overview. You should have two monitoring events created:
- Before deploying this flow to the default broker, make sure that the queues are created and available. Using Message Broker Explorer, create the queues: INQ, OUTQ, and FAILQ:
- You are now ready to deploy the TestApplication. Right-click on the flow, select Deploy, and then select the default execution group. After a few seconds you should see your deployed application in the broker:
- Every time you deploy, flow monitoring is turned off by default, so after you have deployed the application, make sure you turn on flow monitoring using the command:
mqsichangeflowmonitoring MB8BROKER -e default -k TestApplication -f TestFlow -c active
- Run the command below to verify that monitoring is enabled for your flow:
mqsireportflowmonitoring MB8BROKER -e default -k TestApp
- Now that you have the application deployed, you need to test that the flow is working by sending some test messages using the Message Broker Toolkit test client.
Select File => New Message Broker Test Client and create a message named TestMsg:
- You want to enqueue a test message to the MQ queue INQ on the queue manager MB8QMGR, and make sure that it gets to OUTQ. Enter some test message data so that you can view this payload later in the Web Administration:
- After the message has been sent, you can check that it has been sent to OUTQ by looking in Message Broker Explorer and inspecting the queues. You will see a queue depth of 1 on OUTQ:
- Next, test the behaviour of FAILQ. Change OUTQ so that it is put-inhibited by using Message Broker Explorer:
- Now when you send a message, the flow will not be able to put the message to OUTQ, and the message will be caught and routed by the INQ MQInput node and routed to FAILQ. On its way there it will fire a monitoring event capturing the ExceptionList and payload of the message for the Record and Replay database. Here you can see that the second test message has been routed to the FAILQ as expected:
In the next section, you set up the broker to listen for the monitoring events you have set up here, so it can route them to the Record and Replay database.