rrtemporal

package module
v5.11.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 51 Imported by: 2

README

Linux Discourse

Roadrunner Temporal

The repository contains a number of plugins which enable workflow and activity processing for PHP processes. The communication protocol, supervisor, load-balancer is based on RoadRunner PHP Application Server.

Installation

Temporal is an official plugin of RoadRunner and available out-of-the-box in >= RoadRunner 2023.0.

Read more about application server installation here.

To install PHP-SDK:

$ composer require temporal/sdk

License

MIT License

Documentation

Overview

Package rrtemporal provides a RoadRunner plugin that integrates with Temporal workflow engine, enabling workflow and activity processing for PHP applications via protobuf codec over goridge protocol.

Index

Constants

View Source
const (

	// RrMode env variable key
	RrMode string = "RR_MODE"
	// RrCodec env variable key
	RrCodec string = "RR_CODEC"
	// RrCodecVal - codec name should be in sync with the PHP-SDK
	RrCodecVal string = "protobuf"
)
View Source
const (
	APIKey string = "ApiKey"
)
View Source
const (
	MetricsTypeSummary string = "summary"
)

Variables

This section is empty.

Functions

func ActivitiesInfo

func ActivitiesInfo(wi []*internal.WorkerInfo) map[string]*internal.ActivityInfo

func WorkerInfo

func WorkerInfo(c api.Codec, p api.Pool, rrVersion string, wwPID int) ([]*internal.WorkerInfo, error)

func WorkflowsInfo

func WorkflowsInfo(wi []*internal.WorkerInfo) map[string]*internal.WorkflowInfo

Types

type ClientAuthType

type ClientAuthType string
const (
	NoClientCert               ClientAuthType = "no_client_cert"
	RequestClientCert          ClientAuthType = "request_client_cert"
	RequireAnyClientCert       ClientAuthType = "require_any_client_cert"
	VerifyClientCertIfGiven    ClientAuthType = "verify_client_cert_if_given"
	RequireAndVerifyClientCert ClientAuthType = "require_and_verify_client_cert"
)

type Config

type Config struct {
	Metrics                *Metrics     `mapstructure:"metrics"`
	Activities             *pool.Config `mapstructure:"activities"`
	TLS                    *TLS         `mapstructure:"tls, omitempty"`
	Interceptors           []string     `mapstructure:"interceptors"`
	DataConverters         []string     `mapstructure:"data_converters"`
	DisableActivityWorkers bool         `mapstructure:"disable_activity_workers"`

	Address   string `mapstructure:"address"`
	Namespace string `mapstructure:"namespace"`
	CacheSize int    `mapstructure:"cache_size"`
}

Config of the temporal client and dependent services.

func (*Config) InitDefault

func (c *Config) InitDefault() error

type Informer

type Informer interface {
	Workers() []*process.State
}

Informer used to get workers from a particular plugin or set of plugins

type Logger

type Logger interface {
	NamedLogger(name string) *zap.Logger
}

type Metrics

type Metrics struct {
	Driver     string      `mapstructure:"driver"`
	Prometheus *Prometheus `mapstructure:"prometheus"`
	Statsd     *Statsd     `mapstructure:"statsd"`
}

type Plugin

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

func (*Plugin) AddWorker

func (p *Plugin) AddWorker() error

func (*Plugin) Collects

func (p *Plugin) Collects() []*dep.In

Collects registers dependency injection collectors for Temporal worker interceptors and custom payload converters.

func (*Plugin) Init

func (p *Plugin) Init(cfg api.Configurer, log Logger, server api.Server) error

func (*Plugin) MetricsCollector

func (p *Plugin) MetricsCollector() []prom.Collector

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) RPC

func (p *Plugin) RPC() any

func (*Plugin) Ready

func (p *Plugin) Ready() (*status.Status, error)

Ready return readiness status of the particular plugin

func (*Plugin) RemoveWorker

func (p *Plugin) RemoveWorker(ctx context.Context) error

func (*Plugin) Reset

func (p *Plugin) Reset() error

func (*Plugin) ResetAP

func (p *Plugin) ResetAP() error

func (*Plugin) Serve

func (p *Plugin) Serve() chan error

func (*Plugin) Status

func (p *Plugin) Status() (*status.Status, error)

Status return status of the particular plugin

func (*Plugin) Stop

func (p *Plugin) Stop(ctx context.Context) error

func (*Plugin) Workers

func (p *Plugin) Workers() []*process.State

type Prometheus

type Prometheus struct {
	Address string `mapstructure:"address"`
	Type    string `mapstructure:"type"`
	Prefix  string `mapstructure:"prefix"`
}

type RecordHeartbeatRequest

type RecordHeartbeatRequest struct {
	TaskToken []byte `json:"taskToken"`
	Details   []byte `json:"details"`
}

RecordHeartbeatRequest sent by activity to record current state.

type RecordHeartbeatResponse

type RecordHeartbeatResponse struct {
	Canceled bool `json:"canceled"`
	Paused   bool `json:"paused"`
}

RecordHeartbeatResponse sent back to the worker to indicate that activity was canceled.

type StatsExporter

type StatsExporter struct {
	TotalMemoryDesc  *prom.Desc
	StateDesc        *prom.Desc
	WorkerMemoryDesc *prom.Desc
	TotalWorkersDesc *prom.Desc

	WorkersReady   *prom.Desc
	WorkersWorking *prom.Desc
	WorkersInvalid *prom.Desc

	Workers Informer
}

func (*StatsExporter) Collect

func (s *StatsExporter) Collect(ch chan<- prom.Metric)

func (*StatsExporter) Describe

func (s *StatsExporter) Describe(d chan<- *prom.Desc)

type Statsd

type Statsd struct {
	// The host and port of the statsd server
	HostPort string `mapstructure:"host_port" validate:"nonzero"`
	// The prefix to use in reporting to statsd
	Prefix string `mapstructure:"prefix" validate:"nonzero"`
	// FlushInterval is the maximum interval for sending packets.
	// If it is not specified, it defaults to 1 second.
	FlushInterval time.Duration `mapstructure:"flush_interval"`
	// FlushBytes specifies the maximum udp packet size you wish to send.
	// If FlushBytes is unspecified, it defaults  to 1432 bytes, which is
	// considered safe for local traffic.
	FlushBytes int `mapstructure:"flush_bytes"`
	// Tags to pass to the Tally scope options
	Tags map[string]string `mapstructure:"tags"`
	// TagPrefix ...
	TagPrefix string `mapstructure:"tag_prefix"`
	// TagSeparator allows tags to be appended with a separator. If not specified tag keys and values
	// are embedded to the stat name directly.
	TagSeparator string `mapstructure:"tag_separator"`
}

ref:https://github.dev/temporalio/temporal/common/metrics/config.go:79

type StatsdReporterConfig

type StatsdReporterConfig struct {
	// TagSeparator allows tags to be appended with a separator. If not specified tag keys and values
	// are embedded to the stat name directly.
	TagSeparator string `yaml:"tag_separator"`
}

type TLS

type TLS struct {
	Key        string         `mapstructure:"key"`
	Cert       string         `mapstructure:"cert"`
	RootCA     string         `mapstructure:"root_ca"`
	AuthType   ClientAuthType `mapstructure:"client_auth_type"`
	ServerName string         `mapstructure:"server_name"`
	UseH2C     bool           `mapstructure:"use_h2c"`
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Package aggregatedpool implements Temporal workflow and activity definitions that bridge Go-based Temporal SDK workers with PHP worker processes via a message-based protocol.
Package aggregatedpool implements Temporal workflow and activity definitions that bridge Go-based Temporal SDK workers with PHP worker processes via a message-based protocol.
Package api defines interfaces and context utilities used by the Temporal plugin, including pool, codec, server, and interceptor abstractions.
Package api defines interfaces and context utilities used by the Temporal plugin, including pool, codec, server, and interceptor abstractions.
Package canceller provides a thread-safe registry for managing cancellation functions, allowing internal commands such as activities, timers, and child workflows to be canceled by their command ID.
Package canceller provides a thread-safe registry for managing cancellation functions, allowing internal commands such as activities, timers, and child workflows to be canceled by their command ID.
Package dataconverter wraps Temporal's data converter to bypass serialization when data is already in Payloads form, enabling efficient passthrough of protobuf payloads between Go and PHP workers.
Package dataconverter wraps Temporal's data converter to bypass serialization when data is already in Payloads form, enabling efficient passthrough of protobuf payloads between Go and PHP workers.
Package internal defines the protocol messages, context structures, and worker info types used for communication between the Temporal plugin and PHP worker processes.
Package internal defines the protocol messages, context structures, and worker info types used for communication between the Temporal plugin and PHP worker processes.
codec/proto
Package proto implements a protobuf-based codec for encoding and decoding messages exchanged between the Temporal plugin and PHP worker processes.
Package proto implements a protobuf-based codec for encoding and decoding messages exchanged between the Temporal plugin and PHP worker processes.
logger
Package logger provides an adapter that bridges zap.Logger with the go.temporal.io/sdk/log.Logger interface used by the Temporal SDK client.
Package logger provides an adapter that bridges zap.Logger with the go.temporal.io/sdk/log.Logger interface used by the Temporal SDK client.
Package queue provides a thread-safe message queue for exchanging command and response messages between Temporal workflow definitions and PHP worker processes.
Package queue provides a thread-safe message queue for exchanging command and response messages between Temporal workflow definitions and PHP worker processes.
Package registry provides an ID registry for tracking child workflow IDs, enabling access to child workflow identifiers after they become available via callback results.
Package registry provides an ID registry for tracking child workflow IDs, enabling access to child workflow identifiers after they become available via callback results.

Jump to

Keyboard shortcuts

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