BizTalk Terminator STILL Not Cleaning Up Caching Items?
I originally published my BizTalk Terminator Not Cleaning Up Caching Items blog back in 2011 where I suggested to use the Terminate Multiple Instances (Hard Termination) task if the normal WMI-based Terminate Cache Instances task doesn't clean up all the caching instances.
Since then, I've come across a caching cleanup scenario that even the hard termination task can't handle. Basically, if there are cache message refs (in <HOST>Q or <HOST>Q_Suspended tables) that are missing their associated caching instance (in the Instances table), then even the hard termination task won't be able to clean them up. The reason is that the Terminate Multiple Instances (Hard Termination) task finds the instances for termination by looking through the Instances table - so in this case it never sees the orphaned cache message refs.
If you run into this scenario, what you will see is that that once Hard Termination has successfully cleaned up all caching instances, BHM or MBV will continue to complain about cache messages and if you run the View Count of Cache Messages in All Host Queues task, it will show Cache Messages and Message Refs existing even though there are no Associated Cache Instances:
The workaround so far has been to to first run the DELETE Orphaned Messages In All Hosts task (to clean up the orphaned message refs) and then run the Terminate Multiple Instances (Hard Termination) task as mentioned in the previous blog (to clean up the cache instances).
I have also created a new cache cleanup task called Terminate Caching Items (Hard Termination) . This task checks all the <HOST>Q, <HOST>Q_Suspended, and Instances tables for caching items associated with any host and in any state and cleans them all up. The purpose of this new task is to handle all cache item cleanup scenarios with one step - so the user doesn't have to dig into the state of the cache items in their environment to know how to clean them up. So if BHM or MBV complain about cache items, simply running this task on the correct MessageBox should take care of it.
This new task is available in BHM v3.1 and Terminator v2.2.
If you were not already aware that Terminator has been integrated into the BizTalk Health Monitor (BHM) tool, see here.