How to model a business timeout to execute business logic if workflow does not complete in time?

Hi,

I built a workflow consisting of 10 activities called sequentially synchronously as activities downstream take as input the output of upstream activities.

This workflow runs daily and has to complete before 9AM.
If it cannot complete in time, I need the workflow to

  1. stop the currently executing activity
  2. execute an activity to publish on a kafka topic that the workflow could not complete before the deadline
  3. exit

I have seen the concept of timers, but I’ve read this post that discourages from writing async workflow code if not necessary.

How do you recommend I implement the use-case described above?

Thanks!

Could look at recently added sample: samples-java/core/src/main/java/io/temporal/samples/hello/HelloWorkflowTimer.java at main · temporalio/samples-java · GitHub