grpcproxy

package
v0.0.0-...-94a9b73 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

README

Sample overview:

This sample shows how to compress payloads using a GRPC proxy. This allows managing the codec(s) centrally rather than needing to configure each client/worker.

Steps to run this sample:

  1. You need a Temporal service running. See details in README.md
  2. Run the following command to start the GRPC proxy listening on port 8081
go run proxy-server/main.go
  1. Run the following command to start the worker. The worker is configured to connect to the proxy.
go run worker/main.go
  1. Run the following command to start the example. The client the starter uses is configured to connect to the proxy.
go run starter/main.go
  1. Run the following command and see that when tctl is connected directly to Temporal it cannot display the payloads as they are encoded (compressed)
tctl workflow show --wid grpcproxy_workflowID
  1. Run the following command to see that when tctl is connected to Temporal via the proxy it can display the payloads
tctl --address 'localhost:8081' workflow show --wid grpcproxy_workflowID

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Activity

func Activity(ctx context.Context, info map[string]string) (string, error)

func NewDataConverter

func NewDataConverter(underlying converter.DataConverter) converter.DataConverter

NewDataConverter creates a new data converter that wraps the given data converter with snappy compression.

func NewPayloadCodec

func NewPayloadCodec() converter.PayloadCodec

func Workflow

func Workflow(ctx workflow.Context, name string) (string, error)

Workflow is a standard workflow definition. Note that the Workflow and Activity don't need to care that their inputs/results are being compressed.

Types

type Codec

type Codec struct{}

Codec implements converter.PayloadEncoder for snappy compression.

func (*Codec) Decode

func (*Codec) Decode(payloads []*commonpb.Payload) ([]*commonpb.Payload, error)

Decode implements converter.PayloadCodec.Decode.

func (*Codec) Encode

func (e *Codec) Encode(payloads []*commonpb.Payload) ([]*commonpb.Payload, error)

Encode implements converter.PayloadCodec.Encode.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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