couple of seconds. On each execution, we receive updated statistics of execution errors versus completed executions. From these values, we subtract the same values recorded in the previous run so that we get the values for just this period. Once this calculation is complete, we divide the errors with the total events to get a ratio of the two values. If the ratio exceeds a certain threshold (by default set to 0.5), then the String class variable constantlyFailingString is set to true. Having the monitoring code ready, we need to instruct Mule to execute this code every few seconds; 10 seconds for example . We also need to tell ConsistentlyFailingMonitor which Flow to monitor. Spring comes in very handy to do just that. Spring code we need add the in the simple web service mule flow and it follows like