iNTERFACEWARE Products Manual > Learning Center > Tutorials and Sample Scenarios > Email Notification Rule Examples > Detecting When an Idle Channel Restarts > Creating the VMD File |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
To detect when a channel that has been idle is now active, you need to:
Because all of the work of checking for an idle channel is done in the external Python module, the scripts that you need to create for the VMD file are very simple. The Global Inbound Script, which initializes the idle detection process, looks like this:
In this script, the from inactivechannel import * statement tells Python to import code from the inactivechannel.py file that you created in the previous section. The global variable INACTIVITY_TIME specifies how long a channel must be idle before it is considered inactive. Because this value is set here and not in the Python module, you can define different idle times for different channels. The Transformation Script that is defined for the default message is equally simple:
The checkForInactivity() function keeps track of when the last message was sent through the channel. When a new message appears, the current time is compared to the time a message last appeared. If the difference between the two times is large enough, an "idle channel restarted" warning message is printed.
After you have created the scripts, the final step is to modify the VMD file to indicate that it is performing scripted transformation. To do this:
Your VMD file is now ready for use. Now that you have defined the VMD file that detects whether an idle channel has been activated, the next step is to to update your Iguana channel to use this VMD file.
|