Skip to main content

What is a Temporal Client?

A Temporal Client allows you to communicate with the Temporal Service. Communication with a Temporal Service lets you perform actions such as starting Workflow Executions, sending Signals to Workflow Executions, sending Queries to Workflow Executions, getting the results of a Workflow Execution, and providing Activity Task Tokens. When Standalone Activities are supported and enabled, a Temporal Client can also start and manage Standalone Activities directly, without involving a Workflow.

Code examples

The following examples show how to connect a Temporal Client to a local development Temporal Service and start a Workflow Execution.

package main

import (
"context"
"log"

"documentation-samples-go/yourapp"

"go.temporal.io/sdk/client"
)

func main() {
// Create a Temporal Client to communicate with the Temporal Cluster.
// A Temporal Client is a heavyweight object that should be created just once per process.
temporalClient, err := client.Dial(client.Options{
HostPort: client.DefaultHostPort,
})
if err != nil {
log.Fatalln("Unable to create Temporal Client", err)
}
defer temporalClient.Close()
}

SDK guides