runtime

package
v1.19.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 93 Imported by: 14

Documentation

Index

Constants

View Source
const (
	// DefaultDaprHTTPPort is the default http port for Dapr.
	DefaultDaprHTTPPort = 3500
	// DefaultDaprPublicPort is the default http port for Dapr.
	DefaultDaprPublicPort = 3501
	// DefaultDaprAPIGRPCPort is the default API gRPC port for Dapr.
	DefaultDaprAPIGRPCPort = 50001
	// DefaultProfilePort is the default port for profiling endpoints.
	DefaultProfilePort = 7777
	// DefaultMetricsPort is the default port for metrics endpoints.
	DefaultMetricsPort = 9090

	// DefaultMaxRequestBodySize is the default option for the maximum body size in bytes for Dapr HTTP servers.
	// Equal to 4MB
	DefaultMaxRequestBodySize = 4 << 20
	// DefaultAPIListenAddress is which address to listen for the Dapr HTTP and GRPC APIs. Empty string is all addresses.
	DefaultAPIListenAddress = ""
	// DefaultReadBufferSize is the default option for the maximum header size in bytes for Dapr HTTP servers.
	// Equal to 4KB
	DefaultReadBufferSize = 4 << 10
	// DefaultGracefulShutdownDuration is the default option for the duration of the graceful shutdown.
	DefaultGracefulShutdownDuration = time.Second * 5
	// DefaultActorsDisseminationTimeout is the default daprd-side timeout
	// for a placement LOCK -> UPDATE -> UNLOCK round. Must be larger than
	// the placement service --disseminate-timeout (8s default) so that
	// daprd does not reset the stream before placement can finish a
	// legitimately slow round.
	DefaultActorsDisseminationTimeout = time.Second * 30

	DefaultActorsPlacementStartupTimeout = time.Second * 30
	// DefaultAppHealthCheckPath is the default path for HTTP health checks.
	DefaultAppHealthCheckPath = "/healthz"
	// DefaultChannelAddress is the default local network address that user application listen on.
	DefaultChannelAddress = "127.0.0.1"

	// DisableSubscribeInitEndpoint is the config value to disable subscribe endpoint.
	DisableSubscribeInitEndpoint = "subscribe"
	// DisableConfigInitEndpoint is the config value to disable config endpoint.
	DisableConfigInitEndpoint = "config"
)

Variables

AllowedDisableInitEndpoints is the list of allowed init endpoints to disable.

Functions

func WaitUntilDaprOutboundReady added in v1.12.0

func WaitUntilDaprOutboundReady(daprHTTPPort string)

Types

type Config

type Config struct {
	AppID                         string
	ControlPlaneAddress           string
	SentryAddress                 string
	AllowedOrigins                string
	EnableProfiling               bool
	AppMaxConcurrency             int
	EnableMTLS                    bool
	AppSSL                        bool
	MaxRequestSize                int // In bytes
	ResourcesPath                 []string
	ComponentsPath                string
	AppProtocol                   string
	EnableAPILogging              *bool
	DaprHTTPPort                  string
	DaprAPIGRPCPort               string
	ProfilePort                   string
	DaprInternalGRPCPort          string
	DaprInternalGRPCListenAddress string
	DaprPublicPort                string
	DaprPublicListenAddress       string
	ApplicationPort               string
	DaprGracefulShutdownSeconds   int
	DaprBlockShutdownDuration     *time.Duration
	ActorsService                 string
	ActorsDisseminationTimeout    time.Duration
	ActorsPlacementStartupTimeout time.Duration
	RemindersService              string
	SchedulerAddress              []string
	SchedulerStreams              uint
	DaprAPIListenAddresses        string
	AppHealthProbeInterval        int
	AppHealthProbeTimeout         int
	AppHealthThreshold            int
	EnableAppHealthCheck          bool
	Mode                          string
	Config                        []string
	UnixDomainSocket              string
	ReadBufferSize                int // In bytes
	DisableBuiltinK8sSecretStore  bool
	AppHealthCheckPath            string
	AppChannelAddress             string
	Metrics                       metrics.Options
	Registry                      *registry.Options
	Security                      security.Handler
	Healthz                       healthz.Healthz
	WorkflowEventSink             orchestrator.EventSink
	DisableInitEndpoints          []string
	// DaprInternalGRPCListener, when set, returns a listener on the internal
	// gRPC port held by the process (see ReserveInternalGRPCPort).
	DaprInternalGRPCListener func() (net.Listener, error)
	// HotReloadReconcileInterval overrides the hot-reload backup reconcile
	// period. Zero uses the reconciler default (60s).
	HotReloadReconcileInterval time.Duration
	// AppBindingOptionsTimeout overrides the timeout for the subscription discovery
	// request sent to the app for input bindings (HTTP OPTIONS or gRPC ListInputBindings).
	// Non-positive values use config.DefaultAppBindingOptionsTimeout (3s).
	AppBindingOptionsTimeout time.Duration
}

Config holds the Dapr Runtime configuration.

type DaprRuntime

type DaprRuntime struct {
	// contains filtered or unexported fields
}

DaprRuntime holds all the core components of the runtime.

func FromConfig added in v1.12.0

func FromConfig(ctx context.Context, cfg *Config) (*DaprRuntime, error)

FromConfig creates a new Dapr Runtime from a configuration.

func (*DaprRuntime) Run

func (a *DaprRuntime) Run(parentCtx context.Context) error

Run performs initialization of the runtime with the runtime and global configurations.

func (*DaprRuntime) ShutdownWithWait added in v1.1.0

func (a *DaprRuntime) ShutdownWithWait()

ShutdownWithWait will gracefully stop runtime and wait outstanding operations.

func (*DaprRuntime) WaitUntilShutdown added in v1.5.0

func (a *DaprRuntime) WaitUntilShutdown()

type InternalGRPCListener

type InternalGRPCListener struct {
	// contains filtered or unexported fields
}

InternalGRPCListener holds the internal gRPC listening socket. Runtimes serve the socket itself, one at a time, rather than a duplicate: Windows cannot make a listener from a duplicate more than once.

func ReserveInternalGRPCPort

func ReserveInternalGRPCPort(ctx context.Context, listenAddress, port, appID string) (*InternalGRPCListener, int, error)

ReserveInternalGRPCPort binds the internal gRPC port for the life of the process. daprd calls it before making any outbound connection and hands the result to every runtime it starts. Otherwise, on a SIGHUP restart, the port is free from when the old runtime closes its server until the new one binds it, and the new runtime's own connections (sentry, operator, scheduler) can be given it as their ephemeral source port.

func (*InternalGRPCListener) Close

func (l *InternalGRPCListener) Close() error

Close releases the port, or, while a runtime serves it, marks it to be released when that runtime closes its listener.

func (*InternalGRPCListener) Listener

func (l *InternalGRPCListener) Listener(ctx context.Context) (net.Listener, error)

Listener returns the held socket for a runtime whose life is ctx. Closing it stops the runtime's Accept and leaves the port bound, so connections made before the next runtime starts wait in the backlog. A runtime that closes it while ctx is still live is stopping for good (the shutdown API), so the port is released then.

Directories

Path Synopsis
mcp
Package processor manages the lifecycle of every resource that flows through daprd: components, HTTP endpoints, MCP servers and subscriptions.
Package processor manages the lifecycle of every resource that flows through daprd: components, HTTP endpoints, MCP servers and subscriptions.
leadership
Package leadership tracks the scheduler placement leader as observed on the WatchHosts stream, for consumers (the actor placement client) which need to connect to the current leader and react to leadership changes.
Package leadership tracks the scheduler placement leader as observed on the WatchHosts stream, for consumers (the actor placement client) which need to connect to the current leader and react to leadership changes.
inprocess
Package inprocess creates and configures the in-process workflow executor used for dapr-internal workflows (e.g.
Package inprocess creates and configures the in-process workflow executor used for dapr-internal workflows (e.g.

Jump to

Keyboard shortcuts

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