'Stop a streaming dataflow job

I have a pipeline that is consuming messages from kafka and I want the job to get stopped after a certain amount of time of inactivity and then if a new message is produced to kafka a trigger will verify if theres a job running if not that message will intitialize the job trough a dataflow template, I dont know if this is posible or if this is a good aproach.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source