Files
tasks/common/rpc.go
zeekay 1c76604f15 feat: ZAP transport for internode RPC, replace gRPC for history/matching/worker
- New zaptransport package: factory, client, server, rpcserver
- Internode services (history, matching, worker) use ZAP
- Frontend keeps gRPC for Temporal SDK backward compat (for now)
- luxfi/zap added as dependency
2026-04-09 18:18:31 -07:00

37 lines
1.2 KiB
Go

//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination rpc_mock.go
package common
import (
"net"
"net/http"
"google.golang.org/grpc"
)
// RPCFactory creates listeners and connections for inter-service communication,
// and frontend HTTP clients. Transport is ZAP (luxfi/zap) for internode RPC.
type RPCFactory interface {
GetFrontendGRPCServerOptions() ([]grpc.ServerOption, error)
GetInternodeGRPCServerOptions() ([]grpc.ServerOption, error)
GetGRPCListener() net.Listener
CreateRemoteFrontendGRPCConnection(rpcAddress string) grpc.ClientConnInterface
CreateLocalFrontendGRPCConnection() grpc.ClientConnInterface
CreateHistoryGRPCConnection(rpcAddress string) grpc.ClientConnInterface
CreateMatchingGRPCConnection(rpcAddress string) grpc.ClientConnInterface
CreateLocalFrontendHTTPClient() (*FrontendHTTPClient, error)
}
type FrontendHTTPClient struct {
http.Client
// Address is the host:port pair of this HTTP client.
Address string
// Scheme is the URL scheme of this HTTP client.
Scheme string
}
// BaseURL is the scheme and address of this HTTP client.
func (c *FrontendHTTPClient) BaseURL() string {
return c.Scheme + "://" + c.Address
}