Delaying a route

  • Creator
    Topic
  • #49330
    Joseph Paquette
    Participant

    I have a system I am sending a result message along with an order status update message.  The receiving system is having a problem when getting the messages one right after another, I am being asked to delay the textual result message by 5-7 seconds after the order status message.  The way I currently have the system configured is a single thread with two route details going through separate xlates to get my two messages.  Is there an easy way to delay one of the messages by 5-7 seconds??

Viewing 5 reply threads
  • Author
    Replies
    • #61542
      Jason Yaworsky
      Participant

      TCL has built in time functions.  For example

      after 7000

      Will sleep for 7 seconds.  

      I assume you can just add this as a pre-procedure. I hope this helps.

      Jay

    • #61543
      Joseph Paquette
      Participant

      Hello,

      I can setup a proc and give it a try,  I did try using a code frag in the xlate using the after command.  This still sent them at the same time,  will try a new proc with the delay in it to see if that helps.  Thanks

    • #61544
      Scott Lee
      Participant

      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.

      Code:

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

    • #61545
      Jim Kosloskey
      Participant

      Just be careful using these Tcl Time functions (sleep, etc.) as I think they will cause the entire process in which they are executed to delay for the time period.

      That may not be what you want to happen.

      Of course you can always do cross process, but that has it’s considerations as well.

      Jim Kosloskey

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    • #61546
      Scott Lee
      Participant

      Jim, excellent point.  I have this route in a process by itself so no other processing is affected.

    • #61547
      Charlie Bursell
      Participant

      You cannot user “after”or other blocking commands within the engine.

Viewing 5 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,115
Forums
28
Topics
9,290
Replies
34,422
Topic Tags
286
Empty Topic Tags
10