# Write a single workflow with multiple languages

**URL:** <https://community.temporal.io/t/write-a-single-workflow-with-multiple-languages/1200>\
**Category:** Community Support\
**Tags:** workflow-options\
**Created:** [December 18, 2020, 2:36am UTC](https://community.temporal.io/t/write-a-single-workflow-with-multiple-languages/1200 "2020-12-18T02:36:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxnilz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxnilz/32/602_2.png) [@maxnilz](https://community.temporal.io/u/maxnilz)\
**Post date:** [December 18, 2020, 2:36am UTC](https://community.temporal.io/t/write-a-single-workflow-with-multiple-languages/1200/1 "2020-12-18T02:36:41Z")

</div>

is it possible that a single workflow can be written by different languages?  
For example I’d like to implement a workflow that have two activities for some reason I need to write the first activity in java with java sdk and the second activity needs to be written by Golang with Go sdk. how can I combine these two activities into a workflow, is this doable directly or indirectly?

---

<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:** [December 18, 2020, 2:52am UTC](https://community.temporal.io/t/write-a-single-workflow-with-multiple-languages/1200/2 "2020-12-18T02:52:43Z")

</div>

This is fully supported. Make sure that activity workers in different languages are using different task queue names and workflow specifies correct task queue names when invoking these activities.

---

<div class="post-metadata">

**Author:** ![maxnilz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxnilz/32/602_2.png) [@maxnilz](https://community.temporal.io/u/maxnilz)\
**Post date:** [December 18, 2020, 3:55am UTC](https://community.temporal.io/t/write-a-single-workflow-with-multiple-languages/1200/3 "2020-12-18T03:55:01Z")

</div>

thanks very much, will try this out

---

<div class="post-metadata">

**Author:** ![Konstantin\_Ignatyev](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/konstantin_ignatyev/32/397_2.png) [@Konstantin\_Ignatyev](https://community.temporal.io/u/Konstantin_Ignatyev)\
**Post date:** [April 1, 2021, 12:56am UTC](https://community.temporal.io/t/write-a-single-workflow-with-multiple-languages/1200/4 "2021-04-01T00:56:23Z")

</div>

Are there any gotcha-s related to parameters serialization?

Any way to define activity/WF interfaces in gRPC? Just curious

---

<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:** [April 1, 2021, 1:27am UTC](https://community.temporal.io/t/write-a-single-workflow-with-multiple-languages/1200/5 "2021-04-01T01:27:49Z")

</div>

By default JSON serialization is used. So if both languages use structures that are compatible with the generated JSON you should be fine. You can also use protos as their serialization is also supported.

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/luke/32/5106_2.png) [@Luke](https://community.temporal.io/u/Luke)\
**Post date:** [November 3, 2021, 3:07pm UTC](https://community.temporal.io/t/write-a-single-workflow-with-multiple-languages/1200/6 "2021-11-03T15:07:10Z")

</div>

I’m also looking into using mix activities (written in different languages) however I can’t understand how to address “language A activity” from within the “language B workflow” (how can I create the stub if the interface class is in another language ?)

---

<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:** [November 3, 2021, 4:46pm UTC](https://community.temporal.io/t/write-a-single-workflow-with-multiple-languages/1200/7 "2021-11-03T16:46:31Z")

</div>

Here are some examples that show off interaction of client and workflows/activities using different Temporal SDKs:

1. [GitHub - temporalio/temporal-pendulum: Demo showing off Temporal Polyglot features (Java, Go, PHP)](https://github.com/temporalio/temporal-pendulum) - shows how a client can use a typed approach to invoke workflows that are written in different languages supported by Temporal currently.  
The main application is written in Java, and can invoke workflows written in Go, PHP, and TypeScript.  
You can always use the “untyped” approach, meaning create an untyped stub where you invoke a workflow execution by its type name (string). The typed approach shows that you can  
write an interface in Java, and as long as it has the same workflow type, and matches the workflow, signal and query method names you can use that interface to create a typed stub.  
See for example:  
[temporal-pendulum/PositionWorkflow.java at main · temporalio/temporal-pendulum · GitHub](https://github.com/temporalio/temporal-pendulum/blob/main/game/src/main/java/io/temporal/demo/pendulum/PositionWorkflow.java)  
which is used by the game client start, signal, and query:  
[temporal-pendulum/workflow.go at main · temporalio/temporal-pendulum · GitHub](https://github.com/temporalio/temporal-pendulum/blob/main/position-go/workflow.go)  
[temporal-pendulum/workflows.ts at main · temporalio/temporal-pendulum · GitHub](https://github.com/temporalio/temporal-pendulum/blob/main/position-node/src/workflows.ts)  
and  
[temporal-pendulum/PositionWorkflow.php at main · temporalio/temporal-pendulum · GitHub](https://github.com/temporalio/temporal-pendulum/blob/main/position-php/src/Pendulum/PositionWorkflow.php)

2. [GitHub - temporalio/temporal-polyglot](https://github.com/temporalio/temporal-polyglot) - Temporal Polyglot sample that shows more of what I think you are asking here. It shows for example how you can use ExternalWorkflowStub to invoke a Go activity from a Java workflow: [temporal-polyglot/SimpleWorkflowImpl.java at main · temporalio/temporal-polyglot · GitHub](https://github.com/temporalio/temporal-polyglot/blob/main/app-java/src/main/java/org/simple/app/workflow/SimpleWorkflowImpl.java#L39)  
as well as how to call a Java Activity from a Go Workflow: [temporal-polyglot/workflow.go at main · temporalio/temporal-polyglot · GitHub](https://github.com/temporalio/temporal-polyglot/blob/main/app-go/workflow.go#L60)  
Note that in the Java workflow-\>Go activity (and vice versa) in this sample uses the untyped approach but you can also use the typed approach as well in this case as shown in the first example.

As far as data inputs go, as @maxim mentioned, Temporal uses JSON serialization by default. This allows you to do things like invoke a Go activity from Java workflow, and have a data model, for example: [temporal-pendulum/GameInfo.java at main · temporalio/temporal-pendulum · GitHub](https://github.com/temporalio/temporal-pendulum/blob/main/game/src/main/java/io/temporal/demo/pendulum/GameInfo.java)  
to pass it as argument to a workflow or activity and have temporal deserialize the JSON to a struct in Go for example: [temporal-pendulum/workflow.go at main · temporalio/temporal-pendulum · GitHub](https://github.com/temporalio/temporal-pendulum/blob/main/position-go/workflow.go#L9)

1. [GitHub - tsurdilo/temporal-java-workshop: Introduction to writing Java applications using Temporal SDK (and Temporal Server)](https://github.com/tsurdilo/temporal-java-workshop) - in our recent Java SDK Workshop we showed a demo where we stared a PHP workflow, and then stop the worker in the middle of its execution, and then continue and complete it by a Java workflow. You can see the demo here: [Temporal Workshops: Java SDK Intro - YouTube](https://youtu.be/VoSiIwkvuX0?t=1842)

Hope this helps.
