Skip to main content

62 docs tagged with "Java SDK"

View all tags

Activities

Activity Definitions, Activity Execution, Timeouts, Standalone Activities, and benign exceptions in the Temporal Java SDK.

Activity basics

Implement an Activity behind an annotated Java interface, define its parameters and return values, and control Activity Type names with prefixes.

Activity Execution

Invoke Activities synchronously or asynchronously from a Java Workflow, set ActivityOptions and Timeouts, and read the ActivityExecutionContext.

Activity Timeouts

Set the Schedule-To-Close, Start-To-Close, and Heartbeat Timeouts on a Java Activity, tune its Retry Policy, and override the next retry delay.

Add a Standalone Activity

An Activity-backed Operation sends one notification with retries and no Workflow, keyed on the Nexus request Id so a server retry cannot send it twice.

Add messaging to the Service

A Signal nudges a pending approval and an Update records the decision and confirms it, so what the caller needs back decides the message type.

Asynchronous Activity Completion

Asynchronously complete an Activity in a Workflow with Temporal. Follow steps to provide identifying information, use Temporal Client, and set the complete() method.

Benign exceptions

Mark expected or non-severe Activity errors as benign in Java to reduce noise in logs, metrics, and OpenTelemetry traces.

Best practices

This section explains how to implement best practices with the Java SDK

Call the Service

A caller Workflow invokes Operations through the generated stub, awaits the decision durably, and sets the three timeouts that bound a Nexus Operation.

Call the Standalone Activity

Running the approval end to end shows the caller crossing a Namespace boundary without learning a Workflow Id, a Task Queue, or what backs an Operation.

Child Workflows

Start a Child Workflow Execution and set a Parent Close Policy using the Java SDK. Manage Child Workflow Events and ensure successful execution.

Choose a backing implementation

A Workflow, Standalone Activity, Update, or sync messaging can sit behind an Operation. Choose by whether the work waits, holds state, or returns a result.

Client

Connect a Temporal Client, start Workflow Executions, get Workflow results, and manage Namespaces with the Temporal Java SDK.

Continue-As-New

Use Temporal's Continue-As-New in Java to manage large Event Histories by atomically creating new Workflow Executions with the same Workflow Id and fresh parameters.

Data handling

Learn how Temporal handles data through the Data Converter, including payload conversion, encryption, and large payload storage.

Debug common Nexus problems

Hangs, unauthorized calls, missing UI links, and duplicate side effects in a Nexus Service, each traced from the symptom back to the wiring behind it.

Debugging

Debug your Temporal Java Workflows using your favorite Java IDE's debugger. Set the TEMPORAL_DEBUG environment variable to true during debugging to avoid deadlocks. Use Web UI, Temporal CLI, and logging for development and production. Optimize Worker performance with metrics and the Worker performance guide.

Define the data contract

A contract in JSON Schema 2020-12 declares the five approval Operations, the types they carry, and the rules that keep both sides deployable independently.

Error handling

Catch the right exception types, wrap checked exceptions, and inspect failures correctly in Temporal Java Workflows and Activities.

External Storage

Offload large payloads to Amazon S3 using the claim check pattern in the Java SDK.

Generate code from the contract

NexGen emits typed models, runtime validators, and a Nexus Service definition for each language, so handler and caller agree without hand-written types.

Implement the Service

TemporalOperationHandler backs requestApproval with a Workflow that blocks for a human decision, hosted on one Worker with the Activities it runs.

Integrations

This section covers integrations with the Java SDK

Interceptors

Implement Interceptors in the Temporal Java SDK to manage inbound and outbound SDK calls, enhance tracing, and add authorization to your Workflows and Activities.

Interrupt a Workflow Execution

Interrupt a Workflow Execution using the Temporal Java SDK. Choose between canceling for a graceful stop or terminating for a forceful stop.

Java SDK developer guide

Explore Temporal Java SDK feature guides to master developing Temporal Applications. Build Workflows, Activities, and Workers, connect to Temporal Services, set up a testing suite, handle failure detection, send messages, complete Activities asynchronously, implement Versioning, use Observability, debug applications, schedule Workflows

Namespaces

Register, update, deprecate, and delete Namespaces using Temporal CLI or SDK APIs. Manage Workflow Executions with isolated Namespaces to match your needs.

Nexus

This section covers Nexus with the Java SDK

Nexus feature guide

Use Temporal Nexus within the Java SDK to connect Durable Executions within and across Namespaces using a Nexus Endpoint, a Nexus Service contract, and Nexus Operations.

Observability

Explore the observability features of Temporal, including Metrics, Tracing, Logging, and Visibility. Emit Metrics with the Java SDK, set up Tracing, and use Search Attributes.

Payload conversion

Customize how Temporal serializes application objects using Payload Converters in the Java SDK.

Payload encryption

Encrypt data sent to and from the Temporal Service using a custom Payload Codec in the Java SDK.

Platform

This section explains how to implement platform with the Java SDK

Publish the Service in Nexus

A Nexus Endpoint routes Operation requests to the handler Namespace and Task Queue, so callers address it by name and never see what sits behind it.

Run a Worker

Create and run a Temporal Worker using the Java SDK.

Schedules

Schedule, Backfill, Delete, Describe, List, Pause, Trigger, Update, and set Cron and Start Delays for Workflow Executions in Java using Temporal's ScheduleClient.

Send messages to a pending approval

Signal-with-Start attaches a note whether or not the approval exists, and a use-existing conflict policy lets several callers await the same approval.

Serverless Workers

Write Temporal Workers that run on serverless compute using the Java SDK.

Side Effects

Side Effects in a Workflow execute non-deterministic code like generating a UUID. The result is saved in Workflow Event History for consistent replays without re-execution.

Temporal Client

Connect to a development Temporal Service or Temporal Cloud from Java, set WorkflowOptions, and get Workflow Execution results.

Testing

The Testing section of the Temporal Application development guide covers frameworks for Workflow and integration testing, including end-to-end, integration, and unit tests. Unit tests can be set up and run using the Temporal Java SDK's TestWorkflowEnvironment and TestWorkflowExtension classes for automated testing, allowing developers to test Workflows

Timers

A Workflow sets a durable Timer for delayed execution. Even if the Worker or Temporal Service is down, the Timer resumes once back up. Efficient and scalable.

Versioning

The Temporal Platform ensures deterministic Workflow code, offering versioning features in the Java SDK with Workflow Patching APIs and Worker Build Ids for efficient updates.

Workers

This section covers Workers with the Java SDK

Workflow basics

This section explains how to implement Workflows with the Java SDK

Workflow Streams

Stream events from a Workflow to subscribers using the Temporal Java SDK Workflow Streams contrib module.

Workflow Timeouts

Optimize Workflow Execution with Temporal Java SDK - Set Workflow Timeouts and Retry Policies efficiently.

Workflows

This section covers Workflows with the Java SDK