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
- func EnsureNamespaceReady(namespace string) error
- func FetchNamespaces(app core.App) ([]string, error)
- func StartAllWorkersByNamespace(app core.App, namespace string)
- func StartWorkerManagerWorkflow(namespace, oldNamespace string, runnerIDs []string)
- func StopAllWorkers()
- func StopAllWorkersByNamespace(namespace string)
- func TemporalClientSetupHook(app *pocketbase.PocketBase)
- func TemporalWorkersDisabled() bool
- func WorkerManagerAdminRunnerIDs(app core.App) ([]string, error)
- func WorkerManagerPublishedNonAdminRunnerIDs(app core.App) ([]string, error)
- func WorkersHook(app *pocketbase.PocketBase)
Constants ¶
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 ¶
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 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 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.