Documentation
¶
Overview ¶
Package temporal is a Temporal client as a dependency: a configuration section, a client traced and measured through the service's OpenTelemetry providers and logging through its logger, a health probe. The SDK's own connection (BACKPLANE_TEMPORAL_*: hooks, activities, workflows) dials through Options too.
For a Temporal of the service's own — another cluster or namespace:
type Config struct {
config.Backplane `json:"backplane"`
Billing temporal.Config `json:"billing"` // SHOP_BILLING_ADDR, _NS, ...
}
billing := deps.NewDependency(root, temporal.New(cfg.Billing), deps.Name("billing"))
run, err := billing.Get().ExecuteWorkflow(ctx, opts, "Charge", in)
Index ¶
- Constants
- Variables
- func New(cfg Config) deps.Provider[Client]
- func Options(cfg Config, identity string, log *xlog.Logger) (client.Options, error)
- type Client
- type Codec
- func (c Codec) Decode(payloads []*commonpb.Payload) ([]*commonpb.Payload, error)
- func (c Codec) DecodeContext(ctx context.Context, payloads []*commonpb.Payload) ([]*commonpb.Payload, error)
- func (c Codec) DecodeMessage(ctx context.Context, m proto.Message) error
- func (c Codec) DecodeOne(ctx context.Context, p *commonpb.Payload) (*commonpb.Payload, error)
- func (c Codec) Encode(payloads []*commonpb.Payload) ([]*commonpb.Payload, error)
- func (c Codec) EncodeContext(ctx context.Context, payloads []*commonpb.Payload) ([]*commonpb.Payload, error)
- func (c Codec) Sealer() seal.Sealer
- type Config
Constants ¶
const ( DefaultNamespace = "default" DefaultDialTimeout = 2 * time.Second )
Defaults of Config.
const EncodingSealed = "binary/backplane-sealed"
EncodingSealed marks a payload the codec sealed: its data is the original payload, sealed.
Variables ¶
var ErrNoAddr = errors.New("temporal: addr is required")
ErrNoAddr: the section has no address.
var Plain = Codec{} //nolint:gochecknoglobals // a constant value
Plain is the codec of an installation without encryption.
Functions ¶
Types ¶
type Codec ¶ added in v0.6.51
type Codec struct {
// contains filtered or unexported fields
}
Codec seals every payload whole, metadata included, and opens what it sealed; a payload it did not seal passes as it is, so history written before encryption was on stays readable. Plain is the codec that changes nothing.
func (Codec) Decode ¶ added in v0.6.51
Decode implements converter.PayloadCodec (the Temporal SDK gives it no context).
func (Codec) DecodeContext ¶ added in v0.6.51
func (c Codec) DecodeContext(ctx context.Context, payloads []*commonpb.Payload) ([]*commonpb.Payload, error)
DecodeContext opens what the codec sealed, Vault calls bound by ctx.
func (Codec) DecodeMessage ¶ added in v0.6.51
DecodeMessage decodes, in place, every payload m holds, however deep: a history event, a describe or list response read through the raw service API. Without encryption it changes nothing.
func (Codec) DecodeOne ¶ added in v0.6.51
DecodeOne is DecodeContext of one payload, which is not nil.
func (Codec) Encode ¶ added in v0.6.51
Encode implements converter.PayloadCodec (the Temporal SDK gives it no context).
type Config ¶
type Config struct {
// Addr is the frontend's host:port.
Addr string `desc:"Frontend host:port." json:"addr,omitempty"`
Namespace string `desc:"Temporal namespace." json:"ns" schemapb:"default=default"`
TLS config.TLS `desc:"TLS of the connection." json:"tls"`
// APIKey authenticates to Temporal Cloud; it turns TLS on even when TLS
// is not enabled.
APIKey config.Secret `desc:"Temporal Cloud API key; turns TLS on." json:"api_key,omitempty"`
// DialTimeout bounds one connection attempt.
DialTimeout time.Duration `desc:"Bound of one connection attempt." json:"dial_timeout" schemapb:"default=2s"`
// Encryption of the payloads in workflow history; empty: off.
Encryption config.Seal `desc:"Encrypts payloads in workflow history; empty: off." json:"encryption"`
}
Config is the connection's section. Field `ns`: `namespace` is a CEL reserved word.
func (Config) Validate ¶
Validate checks what the schema cannot: the address is set and the TLS material parses.
func (Config) WithDefaults ¶
WithDefaults fills a zero namespace and dial timeout.