hub_safe_sub_set - close subscriptions when messages are not being read


package require Humelib
hub_safe_sub_set mailbox max_message_count close_code


This command is executed in the DMH server process to periodically check to see if unread DMH messages are accumulating in a mailbox queue, and if so, to invoke user-provided cleanup code. Use of this command is highly recommended for subscription data feeds to user interfaces and similar processes that may go away ungracefully.

The DMH server uses a global array with the name of hub_safe_sub to manage the periodic checking. This array can be inspected to diagnose the status of the periodic checking.

The command is part of the Humelib package and it exists in the global namespace.


package require Humelib

proc my_safe_client_open {sendto subname table {max_msgs 200}} {
   # use safe_open to monitor for lost subscriber
   set close_code "SQL {close sub $subname to $table}"
   eval $close_code
   SQL "open sub $subname to $table sendto=$sendto insert update delete *"
   hub_safe_sub_set $sendto $max_msgs $close_code


Hume Integration Software,


DMH  SQL open


datahub, DMH, open, subscription