Documentation
¶
Overview ¶
Package embedded runs the Temporal server in-process inside fallbck-server.
All Temporal services (frontend, internal-frontend, history, matching, worker) bind to a loopback address; nothing here is reachable from outside the host. Agents reach the frontend only through the authenticating gateway on the public port.
Index ¶
Constants ¶
const ( DefaultBindIP = "127.0.0.1" DefaultPortBase = 7233 DefaultHistoryShards = 4 DefaultRetention = 72 * time.Hour DefaultStopTimeout = 30 * time.Second DefaultClusterName = "fallbck" DefaultNamespace = "default" DefaultTemporalDatabase = "temporal" DefaultVisibilityDatabase = "temporal_visibility" PostgresPluginName = "postgres12_pgx" )
Default values for Config
const DefaultReadyTimeout = 90 * time.Second
DefaultReadyTimeout bounds how long Start waits for the frontend to answer
Variables ¶
This section is empty.
Functions ¶
func BootstrapSchema ¶
BootstrapSchema creates the Temporal databases if missing and applies the embedded, versioned schema up to the version shipped with the linked server. It is idempotent and safe to run on every start. Creating databases requires the CREATEDB privilege; if that is not available, pre-create the databases and this only applies the schema.
Types ¶
type Config ¶
type Config struct {
// BindIP is the loopback address every Temporal service listens on
BindIP string
// PortBase is the frontend gRPC port; the other services use PortBase+1..+6 and
// membership ports PortBase-300+n (7233 → 6933…)
PortBase int
// Persistence selects postgres (default) or sqlite (tests)
Persistence Persistence
// DatabaseURL is a postgres:// URL; the database in its path is ignored and replaced
// with TemporalDatabase / VisibilityDatabase
DatabaseURL string
// TemporalDatabase and VisibilityDatabase are the two Postgres databases Temporal needs
TemporalDatabase string
VisibilityDatabase string
// SQLiteFile is the database file for sqlite persistence; empty = in-memory
SQLiteFile string
// HistoryShards is immutable after the first start (persisted in cluster metadata)
HistoryShards int32
// Namespace is registered on first start with Retention
Namespace string
Retention time.Duration
// ClusterName is immutable after the first start
ClusterName string
// DataDir persists the generated cluster ID; empty = random per start (tests)
DataDir string
// StopTimeout bounds Stop(): Temporal's own shutdown can wait minutes for system
// worker long polls to drain; after this the shutdown continues in the background.
StopTimeout time.Duration
}
Config describes the embedded Temporal deployment
func (Config) FrontendAddr ¶
FrontendAddr is the loopback address of the public-facing (but loopback-bound) frontend
type Persistence ¶
type Persistence string
Persistence selects the backing store of the embedded server
const ( // PersistencePostgres stores Temporal state in PostgreSQL (production) PersistencePostgres Persistence = "postgres" // PersistenceSQLite stores state in an in-memory or file SQLite database (tests only; // requires the `sqlite` build tag) PersistenceSQLite Persistence = "sqlite" )
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an in-process Temporal cluster
func New ¶
New validates the configuration and constructs the Temporal server (not yet started). For Postgres persistence, BootstrapSchema must have been run first.
func (*Server) FrontendAddr ¶
FrontendAddr is the loopback host:port of the frontend gRPC service
func (*Server) Start ¶
Start starts every service, waits until the frontend answers, and ensures the configured namespace exists. ctx bounds the readiness wait (DefaultReadyTimeout if none).
func (*Server) Stop ¶
Stop shuts the server down, waiting at most cfg.StopTimeout. Temporal's internal shutdown can block for minutes waiting for its own system workers' long polls; once the timeout passes the remaining teardown continues in the background (the process normally exits right after). Safe to call more than once.