Help us shape the future of Go! Take the 2026 Go Developer Survey

hooks

package
v1.321.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package hooks provides functionality to manage and run Temporal workers for executing workflows and activities in a distributed system. It includes functions to start workers, register workflows and activities, and handle workflow execution.

Index

Constants

View Source
const TemporalWorkersDisabledEnv = "CREDIMI_TEMPORAL_WORKERS_DISABLED"

TemporalWorkersDisabledEnv disables Temporal namespace creation, worker registration and worker-manager workflow starts when set to a truthy value (1, true, yes). Intended for faster local API/UI boots that do not need pipelines or workflows.

Variables

This section is empty.

Functions

func EnsureNamespaceReady

func EnsureNamespaceReady(namespace string) error

EnsureNamespaceReady registers the namespace when missing, waits until Temporal describes it and registers Credimi's custom search attributes on it. It retries with backoff for up to 90 seconds.

func FetchNamespaces

func FetchNamespaces(app core.App) ([]string, error)

func StartAllWorkersByNamespace

func StartAllWorkersByNamespace(app core.App, namespace string)

func StartWorkerManagerWorkflow

func StartWorkerManagerWorkflow(namespace, oldNamespace string, runnerIDs []string)

func StopAllWorkers

func StopAllWorkers()

StopAllWorkers stops the workers of every namespace concurrently and waits for them to drain.

func StopAllWorkersByNamespace

func StopAllWorkersByNamespace(namespace string)

StopAllWorkersByNamespace cancels the namespace's workers and waits up to workerStopWait for them to drain.

func TemporalClientSetupHook

func TemporalClientSetupHook(app *pocketbase.PocketBase)

TemporalClientSetupHook validates the Temporal secrets encryption key and routes Temporal SDK logs through the PocketBase logger when the server starts. It must be bound before any other hook that creates Temporal clients on serve.

func TemporalWorkersDisabled

func TemporalWorkersDisabled() bool

TemporalWorkersDisabled reports whether Temporal workers should stay offline.

func WorkerManagerAdminRunnerIDs

func WorkerManagerAdminRunnerIDs(app core.App) ([]string, error)

func WorkerManagerPublishedNonAdminRunnerIDs

func WorkerManagerPublishedNonAdminRunnerIDs(app core.App) ([]string, error)

func WorkersHook

func WorkersHook(app *pocketbase.PocketBase)

WorkersHook sets up a hook for the PocketBase application to create the namespaces for already existing orgs and starts the workers when the server starts. It binds a function to the OnServe event, which logs a message indicating that workers are starting and then asynchronously starts all workers by calling StartAllWorkers in a separate goroutine.

Parameters:

  • app: The PocketBase application instance to which the hook is attached.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL