Rather than killing it in an Xlate, it would be more efficient to kill it in a tps proc on the route prior to translation. Below is a snippet of code for the ‘run’ section of a tps proc for reference:
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
set disp “CONTINUE”
set msg [msgget $mh]
# get the message length in bytes
set msg_len [string bytelength $msg]
# check to see if the incoming message length in BYTES is more than 1MB
if { $msg_len > 1000000} {
set disp “KILL”
}
If you really want this done in an Xlate then you could set the thread configuration to include the message in USERDATA; then in the Xlate (using Tcl) do a string length on the entire message returning the length; then using Xlate IF Action(s) decide what to do with the length the proc returned.
As an aside, a post I made earlier regards the related efficacy of Tcl vs Xlate filtering. My conclusion was there is little difference in performance. If you are interested, find that post or email me and I will send the product of my research.
And, no I do not have code to do specifically what you ask but it is pretty straightforward to do what I outlined above.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.