Execute some code immediately after workflow completion?

Is there a way to execute some code immediately after workflow completion?

Use cases:

  • Analytics
  • Audit
  • Cleanup e.t.c…

The only thought I can think of is to have a last activity that does all the above, but I want to see if there’s any flexibility at the workflow level.

1 Like

I do not believe we surface any explicit hooks for these lifecycle events but it’s something that’s been requested quite a few times so we’re tracking it. There are ways to achieve this with an activity.

The question is what does it mean to “execute some code immediately after workflow completion”?

For example if this code fails should it be retried? If retried for how long? What if this code need to execute multiple steps? After thinking about such requirements you realize that such code should be a part of a workflow.

One alternative that we are considering is to support sending a message to some external queue upon workflow completion. As most queues provide durability and other guarantees it might unblock some of the use cases above.


That would be great. This would allow easy integration with other systems. Analytics is one example, but also monitoring and progress report are use-cases that would be easy to implement with such integration. I would say that any event in the workflow should be a message to an external queue, not only the workflow completion.
In the other hand, if we don’t have a message system, would it be feasable to get it directly from the database, for example, using Kafka Connectors. Does it make sense?


Yes, it does make a lot of sense. @ryland would you track this as a feature request, please?


Already tracking it! :slight_smile: