# Temporal Workflow Orchestration between multiple microservices

**URL:** <https://community.temporal.io/t/temporal-workflow-orchestration-between-multiple-microservices/10026>\
**Category:** Community Support\
**Tags:** java-sdk\
**Created:** [November 6, 2023, 3:36am UTC](https://community.temporal.io/t/temporal-workflow-orchestration-between-multiple-microservices/10026 "2023-11-06T03:36:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sakshi\_Patil](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/sakshi_patil/32/4293_2.png) [@Sakshi\_Patil](https://community.temporal.io/u/Sakshi_Patil)\
**Post date:** [November 6, 2023, 3:36am UTC](https://community.temporal.io/t/temporal-workflow-orchestration-between-multiple-microservices/10026/1 "2023-11-06T03:36:02Z")

</div>

Hi  
I am migrating one of my conductor workflow to temporal.  
In this workflow there are multiple process that have to occur which are present in multiple micro-services.

Module 1 → Process 1 & 9  
Module 2 → Process 2, 3, 4, 5  
Module 3 → Process 6 , 7  
Module 4 → Process 7, 8

What will be the best practice to create this in temporal?  
My first solution was to create separate worker in all 4 modules which will implement their respective processes in their module but i want to understand if there is any other way temporal supports multiple activities in different microservices?

---

<div class="post-metadata">

**Author:** ![antonio.perez](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/antonio.perez/32/2417_2.png) [@antonio.perez](https://community.temporal.io/u/antonio.perez)\
**Post date:** [November 6, 2023, 6:58pm UTC](https://community.temporal.io/t/temporal-workflow-orchestration-between-multiple-microservices/10026/3 "2023-11-06T18:58:52Z")

</div>

Hello @Sakshi_Patil

welcome to Temporal

do you need the activities to run in the same host as the microservice? or do the microservice expose some API you can invoke to perform each step?

- If you need the activities to run in the same machine, you can schedule each activity in a different taskqueue, through activity options eg “taskqueue-module1”, “taskqueue-module2”

```auto

            ActivityOptions.newBuilder()
                    .setTaskQueue("taskqueue-module1")
                    .setStartToCloseTimeout(...).build());

```

and have the worker running in the microservice, listening on the taskqueue the activity was scheduled.

> but i want to understand if there is any other way temporal supports multiple activities in different microservices?

- If your your microservices expose an api you can communicate with, another approach would be to write those activities in a way that they interact with the microservice, and have all activities running in the same taskqueue.

Let me know if it helps,

Antonio

---

<div class="post-metadata">

**Author:** ![Sakshi\_Patil](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/sakshi_patil/32/4293_2.png) [@Sakshi\_Patil](https://community.temporal.io/u/Sakshi_Patil)\
**Post date:** [November 9, 2023, 6:29am UTC](https://community.temporal.io/t/temporal-workflow-orchestration-between-multiple-microservices/10026/4 "2023-11-09T06:29:33Z")

</div>

Thanks @antonio.perez for the quick response!

I have 2 Microservice:

1. Multi-Module Microservice A
2. Microservice B

Use case: orchestration between multi-module ms A as well as B service.

I have decided to take child workflow route. Basically i am creating child workflow for communicating between these multi-modules as well as service B. I just want to understand is this the best way?

---

<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:** [November 9, 2023, 6:09pm UTC](https://community.temporal.io/t/temporal-workflow-orchestration-between-multiple-microservices/10026/5 "2023-11-09T18:09:37Z")

</div>

There is no single “best way”. If you are calling code in another service then this code should be either a child workflow or an activity. And B service should use its own task queue name.

For modules that lives in the same service you can use child workflows, but it is not required. In many cases having a single workflow that implements multiple modules might be simpler.
