# Waiting for workflow completion

**URL:** <https://community.temporal.io/t/waiting-for-workflow-completion/1458>\
**Category:** Community Support\
**Created:** [February 7, 2021, 8:47pm UTC](https://community.temporal.io/t/waiting-for-workflow-completion/1458 "2021-02-07T20:47:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amlanroy1980](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@amlanroy1980](https://community.temporal.io/u/amlanroy1980)\
**Post date:** [February 7, 2021, 8:47pm UTC](https://community.temporal.io/t/waiting-for-workflow-completion/1458/1 "2021-02-07T20:47:10Z")

</div>

After starting a workflow asynchronously, I want to wait for its completion but with a timeout. For example, the WorkflowExecutionTimeout is set to 60 seconds while starting the workflow asynchronously. But I want to wait only for 10 seconds and then return to the caller. The workflow should continue to execute for 60 seconds.

How can I achieve this? I did not find any API to specify the 10 seconds timeout while reconnecting to the already started workflow. I referred to the page [https://docs.temporal.io/docs/java-starting-workflow-executions/](https://docs.temporal.io/docs/java-starting-workflow-executions/) (the API also seems to have changed from the example shown on this page).

---

<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:** [February 7, 2021, 10:44pm UTC](https://community.temporal.io/t/waiting-for-workflow-completion/1458/2 "2021-02-07T22:44:02Z")

</div>

You can use [WorkflowStub.getResult](https://github.com/temporalio/sdk-java/blob/30420212a26283cf7cbe6339512058a3186074e8/temporal-sdk/src/main/java/io/temporal/client/WorkflowStub.java#L119):

```java
      WorkflowExecution execution = WorkflowClient.start(workflow::workflow1, "input1");
      WorkflowStub untyped = WorkflowStub.fromTyped(workflow);
      String result = untyped.getResult(10, TimeUnit.SECONDS, String.class);

```

---

<div class="post-metadata">

**Author:** ![amlanroy1980](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@amlanroy1980](https://community.temporal.io/u/amlanroy1980)\
**Post date:** [February 9, 2021, 7:11pm UTC](https://community.temporal.io/t/waiting-for-workflow-completion/1458/3 "2021-02-09T19:11:28Z")

</div>

Thanks Maxim, it worked.
