|
14 | 14 | use Temporal\Client\GRPC\ServiceClientInterface; |
15 | 15 | use Temporal\Workflow\WorkflowRunInterface; |
16 | 16 |
|
17 | | -/** |
18 | | - * Client to the Temporal service used to start and query workflows by external processes. Also it |
19 | | - * supports creation of {@link ActivityCompletionClient} instances used to complete activities |
20 | | - * asynchronously. Do not create this object for each request, keep it for the duration of the |
21 | | - * process. |
22 | | - * |
23 | | - * <p>Given a workflow interface executing a workflow requires initializing a {@link |
24 | | - * io.temporal.client.WorkflowClient} instance, creating a client side stub to the workflow, and |
25 | | - * then calling a method annotated with {@literal @}{@link WorkflowMethod}. |
26 | | - * |
27 | | - * <pre><code> |
28 | | - * $workflowClient = new WorkflowClient($serviceClient, ClientOptions::new()->withNamespace('default')); |
29 | | - * |
30 | | - * // Create a workflow stub. |
31 | | - * $fileWorkflow = $workflowClient->newWorkflowStub(FileProcessingWorkflow::class); |
32 | | - * </code></pre> |
33 | | - * |
34 | | - * There are two ways to start workflow execution: synchronously and asynchronously. Synchronous |
35 | | - * invocation starts a workflow and then waits for its completion. If the process that started the |
36 | | - * workflow crashes or stops waiting, the workflow continues executing. Because workflows are |
37 | | - * potentially long running, and crashes of clients happen, it is not very commonly found in |
38 | | - * production use. Asynchronous start initiates workflow execution and immediately returns to the |
39 | | - * caller. This is the most common way to start workflows in production code. |
40 | | - * |
41 | | - * <p>Synchronous start: |
42 | | - * |
43 | | - * <pre><code> |
44 | | - * // Start a workflow and wait for a result. |
45 | | - * // Note that if the waiting process is killed, the workflow will continue executing. |
46 | | - * String result = workflow.processFile(workflowArgs); |
47 | | - * </code></pre> |
48 | | - * |
49 | | - * Asynchronous when the workflow result is not needed: |
50 | | - * |
51 | | - * <pre><code> |
52 | | - * // Returns as soon as the workflow starts. |
53 | | - * WorkflowExecution workflowExecution = WorkflowClient.start(workflow::processFile, workflowArgs); |
54 | | - * |
55 | | - * System.out.println("Started process file workflow with workflowId=\"" + workflowExecution.getWorkflowId() |
56 | | - * + "\" and runId=\"" + workflowExecution.getRunId() + "\""); |
57 | | - * </code></pre> |
58 | | - * |
59 | | - * Asynchronous when the result is needed: |
60 | | - * |
61 | | - * <pre><code> |
62 | | - * CompletableFuture<String> result = WorkflowClient.execute(workflow::helloWorld, "User"); |
63 | | - * </code></pre> |
64 | | - * |
65 | | - * If you need to wait for a workflow completion after an asynchronous start, maybe even from a |
66 | | - * different process, the simplest way is to call the blocking version again. If {@link |
67 | | - * WorkflowOptions#getWorkflowIdReusePolicy()} is not {@code AllowDuplicate} then instead of |
68 | | - * throwing {@link WorkflowExecutionAlreadyStarted}, it reconnects to an existing workflow and waits |
69 | | - * for its completion. The following example shows how to do this from a different process than the |
70 | | - * one that started the workflow. All this process needs is a {@code WorkflowId}. |
71 | | - * |
72 | | - * <pre><code> |
73 | | - * FileProcessingWorkflow workflow = workflowClient.newWorkflowStub(FileProcessingWorkflow.class, workflowId); |
74 | | - * // Returns result potentially waiting for workflow to complete. |
75 | | - * String result = workflow.processFile(workflowArgs); |
76 | | - * </code></pre> |
77 | | - * |
78 | | - * @see io.temporal.workflow.Workflow |
79 | | - * @see Activity |
80 | | - * @see io.temporal.worker.Worker |
81 | | - */ |
82 | 17 | interface WorkflowClientInterface |
83 | 18 | { |
84 | 19 | /** |
|
0 commit comments