web stats
Mirth Community - View Single Post - Mirth Tools: User defined functions
View Single Post
Old 07-30-2014, 06:59 AM
cmcwhorter cmcwhorter is offline
OBX.2 Kenobi
Join Date: Apr 2008
Location: Texas
Posts: 90

Version 3.0.3 of Mirth Connect. Function to Stop a channel if it reaches a particular error count. Also sends an alert message via another channel. Big Nod to Mirth Support for helping me figure out how to do this in version 3.0.3.

Code In Postprocessor of Scripts tab of Channel:

// will stop the current channel when errorcount greater than 10.

var numOfErrors = ChannelUtil.getErrorCount(channelId);

if(numOfErrors > 10)
var channelName = ChannelUtil.getDeployedChannelName(channelId);
alert = 'channel ' + channelName + ' has been stopped with >10 errors';
router.routeMessage('email_Alerts', alert);
Reply With Quote