Recommended way to handling versioning in temporal workflows

Hi,

I have a use-case where I need to add or remove an activity from a workflow. Do you have a recommendation on how to use workflow.getVersion() to manage workflow versions ?
I want to make sure the existing running workflows are not affected. Can you share some example code ?

Take a look at docs and the video: Versioning | Temporal documentation

You can also look at this sample: GitHub - tsurdilo/temporal-versioning-java: Temporal versioning demo - Java SDK

Hope this helps

@tihomir @maxim
What are the type of changes that makes workflow code non-deterministic and requires versioning ?
My use-case is I am looking to modify an exception from IllegalArgumentTypeException to another custom exception for an activity. Would this require versioning ?

What are the type of changes that makes workflow code non-deterministic and requires versioning?

I would say any changes that can change the order of externally observable side effects. The change you are proposing can be non deterministic if workflow handles this exception differently than the exception that was thrown before that.

I am looking to modify an exception from IllegalArgumentTypeException to another custom exception for an activity.

Note that any custom exception is converted into ApplicationFailure. So unless you check the exception type to handle it differently then the change is probably backward compatible.