new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Temporal · all subjects

workflows: lifecycle & control

15 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Synchronous Workflow Execution in Java

Synchronous invocation starts a Workflow and then waits for its completion. If the process that started the Workflow crashes or stops waiting, the Workflow continues executing. Because Workflows are potentially long-running and Client crashes happen, synchronous invocation is not commonly found in production use.

Asynchronous Workflow Execution in Java

Asynchronous start initiates a Workflow Execution and immediately returns to the caller. This is the most common way to start Workflows in production code. The `WorkflowClient` provides static methods such as `start`, `execute`, and `signalWithStart` to help with starting Workflows asynchronously.

Start Workflow synchronously with typed WorkflowStub in Java

Create a typed Workflow stub, then call the Workflow method directly and the stub handles blocking until completion. Example: `NotifyUserAccounts workflow = client.newWorkflowStub(NotifyUserAccounts.class, WorkflowOptions.newBuilder().setWorkflowId("notifyAccounts").setTaskQueue(taskQueue).build()); workflow.notify(accountIds);`

Start Workflow asynchronously with typed WorkflowStub in Java

Create a typed Workflow stub and use `WorkflowClient.start(workflow::methodName)` to return immediately without waiting for completion. Example: `FileProcessingWorkflow workflow = client.newWorkflowStub(FileProcessingWorkflow.class, WorkflowOptions.newBuilder().setTaskQueue(taskQueue).setWorkflowId(workflowId).build()); WorkflowClient.start(workflow::greetCustomer);`

Start Workflow asynchronously with untyped WorkflowStub in Java

Use `client.newUntypedWorkflowStub()` with WorkflowOptions to create an untyped stub, then call `untyped.start(argument)`. This blocks until the Workflow Execution has been started but not until it completes.

Get synchronous Workflow Execution result in Java

Call the Workflow method on the typed Workflow stub directly. The call blocks until the Workflow Execution completes (or fails) and returns the result or error. Example: `String result = workflow.processfile(new Argument());`

Get asynchronous Workflow Execution result in Java

If you need to wait for a Workflow Execution to complete after an asynchronous start, call the blocking Workflow instance again. If WorkflowOptions.WorkflowIdReusePolicy is not set to AllowDuplicate, it reconnects to an existing Workflow and waits for its completion instead of throwing DuplicateWorkflowException.

Connect to existing Workflow from different process in Java

Create a new typed Workflow stub with just the workflow ID (no options) or use `UntypedWorkflowStub`. Example: `YourWorkflow workflow = client.newWorkflowStub(YourWorkflow.class, workflowId); String result = workflow.yourMethod();` or `WorkflowStub workflowStub = client.newUntypedWorkflowStub(workflowType, workflowOptions); String result = untyped.getResult(String.class);`

WorkflowExecutionTimeout default value in Go

The WorkflowExecutionTimeout field in StartWorkflowOptions has a default value of unlimited.

WorkflowRunTimeout default value in Go

The WorkflowRunTimeout field in StartWorkflowOptions has a default value of same as WorkflowExecutionTimeout.

WorkflowTaskTimeout default value in Go

The WorkflowTaskTimeout field in StartWorkflowOptions has a default value of 10 seconds (time.Seconds * 10).

WorkflowIDReusePolicy default value in Go

The WorkflowIDReusePolicy field in StartWorkflowOptions has a default value of enums.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE.

RetryPolicy for Workflow Execution in Go

Create an instance of RetryPolicy from the go.temporal.io/sdk/temporal package and provide it as the value to the RetryPolicy field of StartWorkflowOptions. RetryPolicy fields include InitialInterval, BackoffCoefficient, and MaximumInterval.

CronSchedule field in StartWorkflowOptions

The CronSchedule field in StartWorkflowOptions accepts a cron expression string (e.g., "15 8 * * *") to schedule recurring Workflow Executions. Type: string, Default: None.

HasLastCompletionResult and GetLastCompletionResult for Cron Workflows in Go

Use HasLastCompletionResult() to check if a previous Workflow Run result exists, and GetLastCompletionResult() to retrieve it in your Workflow code. These are available from the go.temporal.io/sdk/workflow package. This works even if one of the cron Workflow Runs fails; the next Workflow Run gets the result of the last successfully Completed Workflow Run.

Give your agent this brain