Documentation
¶
Overview ¶
Package temporal implements the process lifecycle for a GoBeyond worker binary that polls one Temporal task queue (ADR 006 / ADR 007).
Environment:
- GOBEYOND_TEMPORAL_ADDRESS — host:port (default localhost:7233)
- GOBEYOND_TEMPORAL_NAMESPACE — Temporal namespace (default default)
- GOBEYOND_TEMPORAL_TASK_QUEUE — required resolved queue {workerId}__{environment}
- GOBEYOND_TEMPORAL_API_KEY — optional Temporal Cloud API key (mutually exclusive with mTLS)
- GOBEYOND_TEMPORAL_TLS_CERT — optional client certificate PEM (requires TLS_KEY)
- GOBEYOND_TEMPORAL_TLS_KEY — optional client private key PEM (requires TLS_CERT)
Auth modes: local plaintext (neither API key nor mTLS), API-key TLS, or mTLS via X509KeyPair. Setting only one of TLS_CERT/TLS_KEY is an error; setting both API key and mTLS is an error.
Hosted/preview clients must not put Temporal admin keys or leaf PEMs in web sandboxes; this adapter is for worker bundles only.
Index ¶
Constants ¶
const ( EnvAddress = "GOBEYOND_TEMPORAL_ADDRESS" EnvNamespace = "GOBEYOND_TEMPORAL_NAMESPACE" EnvTaskQueue = "GOBEYOND_TEMPORAL_TASK_QUEUE" EnvAPIKey = "GOBEYOND_TEMPORAL_API_KEY" EnvTLSCert = "GOBEYOND_TEMPORAL_TLS_CERT" EnvTLSKey = "GOBEYOND_TEMPORAL_TLS_KEY" // Hosted readiness contract matches adapters/listen (gbhost unixgram nonce). EnvReadinessNonce = "GOBEYOND_READINESS_NONCE" EnvReadinessSignal = "GOBEYOND_READINESS_SIGNAL" )
Variables ¶
This section is empty.
Functions ¶
func ReportWorkerHealth ¶
func ReportWorkerHealth(ctx context.Context, health WorkerHealth) error
ReportWorkerHealth POSTs saturation/tasks to gbhost's host-report UDS. Best-effort: missing socket (local Docker) is a no-op success.
func Serve ¶
Serve dials Temporal, runs one worker for Options.TaskQueue, and blocks until SIGINT/SIGTERM or ctx cancellation.
After Dial, the namespace probe (ListOpenWorkflow) and worker poller start run in parallel. Hosted unixgram readiness is signaled only when both succeed (fail-closed: Dial alone is not enough; a failed probe tears down the worker and never signals ready).
Types ¶
type Options ¶
type Options struct {
Address string
Namespace string
TaskQueue string
APIKey string
// TLSCert and TLSKey are PEM-encoded client certificate material for mTLS.
TLSCert string
TLSKey string
Register RegisterFunc
}
Options configures the Temporal worker process.
type RegisterFunc ¶
RegisterFunc configures workflows and activities on a Temporal worker.
type WorkerHealth ¶
type WorkerHealth struct {
Saturated bool `json:"saturated"`
TasksAssigned int `json:"tasks_assigned"`
TasksAvailable int `json:"tasks_available"`
MemoryHeadroomMB int `json:"memory_headroom_mb,omitempty"`
CPUHeadroomPercent int `json:"cpu_headroom_percent,omitempty"`
}
WorkerHealth is saturation / slot pressure reported to gbhost (ReportWorkerHealth → schedule heartbeat).