On our current platform, our workflow uses a Checkpointer class to record specific events to our DB. We’d like to move to Temporal, but want to keep the checkpointer class for recording a semantic history of the workflow in the same format as done currently.
The checkpointer wraps the DB service, which is a clear candidate for an activity, but the checkpointer itself uses generics (the output of each checkpoint is generic), lambdas (allowing the client to inject custom logic per checkpoint), and types (to deal with Java type erasure…) in its method signatures, all of which aren’t standard POJO elements, suggesting that the checkpointer interface can’t be an activity interface.
My intuition would be to inject an activity stub into the checkpointer and inject the checkpointer into the workflow, but the workflow must have a parameterless constructor.
Do I need to take on a static dependency (call
new Checkpointer(acitivityStub, other, deps, ...)) in the workflow code, or is there another way I should be approaching this problem?