# Executing same workflow twice and then making first workflow complete

**URL:** https://community.temporal.io/t/executing-same-workflow-twice-and-then-making-first-workflow-complete/16165
**Category:** Community Support
**Tags:** java-sdk, signals, workflow-implementat
**Created:** [January 21, 2025, 6:07am UTC](https://community.temporal.io/t/executing-same-workflow-twice-and-then-making-first-workflow-complete/16165 "2025-01-21T06:07:53Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sb101](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@sb101](https://community.temporal.io/u/sb101)
#### Post date: [January 21, 2025, 6:07am UTC](https://community.temporal.io/t/executing-same-workflow-twice-and-then-making-first-workflow-complete/16165/1 "2025-01-21T06:07:53Z")

</div>

I have 2 events coming from Kafka queue with same json schema. Both events will have a field “batch\_id” which will be same. I have a workflow with 5 activities say “mainWorkflow”. I want to execute this mainWorkflow twice, one for each event and only then mark the overall operation complete. How to implement this scenario where I want to run a sub-workflow of same type from my mainWorkflow and wait for completion of both these workflows? Should I use a parent/child relationship here or is there a better way to implement this?

---

<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: [January 21, 2025, 8:35pm UTC](https://community.temporal.io/t/executing-same-workflow-twice-and-then-making-first-workflow-complete/16165/2 "2025-01-21T20:35:49Z")

</div>

I would just run a loop with two iterations within a single workflow.
