To prevent in-flight data loss when undeploying / redeploying templates:
provide a new section in the "undeploy" which takes a list of processgroup-processors (e.g. "Get Kafka 123", "Get RabbitMQ 456", "ExecuteSql 789" to stop
iterate through connections and wait until all queues are drained to zero, in addition to the current waiting until all processor threads are stopped
then proceed with the undeploy / delete process group etc.
To prevent in-flight data loss when undeploying / redeploying templates: