Killing messages using an XLATE

Clovertech Forums Cloverleaf Killing messages using an XLATE

  • Creator
    Topic
  • #121548
    Krishna Kumar
    Participant

      Killing messages. Is there a way I can kill a message after checking its size in an XLATE?

      If so can you please share the code?

    Viewing 1 reply thread
    • Author
      Replies
      • #121549
        James Cobane
        Participant

          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”
          }

          lappend dispList “$disp $mh”
          }

          return $dispList

           

        • #121552
          Jim Kosloskey
          Participant

            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.

        Viewing 1 reply thread
        • You must be logged in to reply to this topic.