Here’s the code I added to a thread to slow the output messages. I used the sleep command rather than the after command. Not sure if that makes any differece. Also, I have this proc as an outbound tps proc because if the messages get queued up in the engine, I still want the messages to go out slowly.
######################################################################
# Name: tps_msg_throttle
# Programmer: Scott R. Lee
# Purpose: Slow down messages going out to EDM. Charges from Affinity
# can be sent too quickly for EDM to handle them and
# other messages (mainly ADTs) get queued up behind them.
#
# Edits: 6/4/07 – Scott R. Lee
# Changed sleep time from 1 second to .5 seconds.
# 6/6/07 – Scott R. Lee
# Changed sleep time back to 1 second.
#
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (”start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
#
#
proc tps_msg_throttle { args } {
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
echo sleeping 1
sleep 1
lappend dispList “CONTINUE $mh”
}
time {
# Timer-based processing
# N.B.: there may or may not be a MSGID key in args
}
shutdown {
# Doing some clean-up work
}
}
return $dispList
}