gateway

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package gateway exposes a narrow, authenticated slice of the Temporal WorkflowService to backup agents on the server's public port.

Agents are Temporal SDK activity workers. Instead of reaching the Temporal frontend directly they speak gRPC to fallbck-server, which authenticates the agent bearer token, allows only the RPCs an activity-only worker needs, pins every call to the agent's own task queue and forwards it to the real frontend (embedded loopback or an external cluster). This makes the gateway the single authorization boundary for agents regardless of how Temporal is deployed.

Index

Constants

View Source
const MaxMessageSize = 64 * 1024 * 1024

MaxMessageSize matches Temporal's default frontend limit (4 MiB) with headroom

Variables

This section is empty.

Functions

func Dial

func Dial(addr string, tlsConfig *tls.Config) (*grpc.ClientConn, error)

Dial connects to a Temporal frontend for use as the gateway backend. tlsConfig nil means plaintext (the embedded loopback frontend).

func IsGRPCRequest

func IsGRPCRequest(r *http.Request) bool

IsGRPCRequest reports whether an HTTP/2 request carries gRPC

Types

type AgentVerifier

type AgentVerifier interface {
	Verify(ctx context.Context, bearer string) (*auth.AgentClaims, error)
}

AgentVerifier authenticates agent bearer tokens (implemented by *auth.AgentVerifier)

type Gateway

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

Gateway is the authenticating WorkflowService proxy

func New

func New(backend workflowservice.WorkflowServiceClient, verifier AgentVerifier, namespace string, logger *slog.Logger) *Gateway

New builds a gateway in front of backend for the given namespace

func (*Gateway) GRPCServer

func (g *Gateway) GRPCServer() *grpc.Server

GRPCServer exposes the underlying server (for ServeHTTP or a dedicated listener)

func (*Gateway) GracefulStop

func (g *Gateway) GracefulStop()

GracefulStop stops accepting new RPCs and waits for in-flight ones

func (*Gateway) Handler

func (g *Gateway) Handler(next http.Handler) http.Handler

Handler routes gRPC requests to the gateway and everything else to next. Mount it as the root handler of an h2c-enabled http.Server.

func (*Gateway) RegisterService added in v0.6.0

func (g *Gateway) RegisterService(desc *grpc.ServiceDesc, impl any)

RegisterService adds another gRPC service (e.g. the PBS backup tunnel) to the gateway server. Its RPCs are subject to the same agent authentication.

Jump to

Keyboard shortcuts

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