Recommended way to handling versioning in temporal workflows


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