# Recommended way to handling versioning in temporal workflows

**URL:** <https://community.temporal.io/t/recommended-way-to-handling-versioning-in-temporal-workflows/3162>\
**Category:** Community Support\
**Tags:** java-sdk, workflow-options\
**Created:** [October 13, 2021, 8:08pm UTC](https://community.temporal.io/t/recommended-way-to-handling-versioning-in-temporal-workflows/3162 "2021-10-13T20:08:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nkatre](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@nkatre](https://community.temporal.io/u/nkatre)\
**Post date:** [October 13, 2021, 8:08pm UTC](https://community.temporal.io/t/recommended-way-to-handling-versioning-in-temporal-workflows/3162/1 "2021-10-13T20:08:59Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [October 13, 2021, 9:55pm UTC](https://community.temporal.io/t/recommended-way-to-handling-versioning-in-temporal-workflows/3162/2 "2021-10-13T21:55:38Z")

</div>

Take a look at docs and the video: [Versioning | Temporal documentation](https://docs.temporal.io/docs/java/versioning/)

You can also look at this sample: [GitHub - tsurdilo/temporal-versioning-java: Temporal versioning demo - Java SDK](https://github.com/tsurdilo/temporal-versioning-java)

Hope this helps

---

<div class="post-metadata">

**Author:** ![nkatre](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@nkatre](https://community.temporal.io/u/nkatre)\
**Post date:** [October 19, 2021, 3:41pm UTC](https://community.temporal.io/t/recommended-way-to-handling-versioning-in-temporal-workflows/3162/3 "2021-10-19T15:41:23Z")

</div>

@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 ?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [October 19, 2021, 4:52pm UTC](https://community.temporal.io/t/recommended-way-to-handling-versioning-in-temporal-workflows/3162/4 "2021-10-19T16:52:47Z")

</div>

> 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.
