https://github.com/cludden/protoc-gen-go-temporal
a protoc plugin for generating Temporal clients and workers in Go from protobuf schemas
https://github.com/cludden/protoc-gen-go-temporal
buf go golang protobuf protoc temporal
Last synced: 3 months ago
JSON representation
a protoc plugin for generating Temporal clients and workers in Go from protobuf schemas
- Host: GitHub
- URL: https://github.com/cludden/protoc-gen-go-temporal
- Owner: cludden
- License: other
- Created: 2023-02-17T01:12:54.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-12T23:17:51.000Z (about 2 years ago)
- Last Synced: 2024-04-13T10:05:59.725Z (about 2 years ago)
- Topics: buf, go, golang, protobuf, protoc, temporal
- Language: Go
- Homepage: https://cludden.github.io/protoc-gen-go-temporal/
- Size: 3.36 MB
- Stars: 51
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# protoc-gen-go-temporal
[](https://cludden.github.io/protoc-gen-go-temporal/)
[](https://pkg.go.dev/github.com/cludden/protoc-gen-go-temporal)
[](https://buf.build/cludden/protoc-gen-go-temporal)
[](https://temporal.io/code-exchange/go-code-generation-with-temporal-and-protobufs)
A protoc plugin for generating typed Temporal clients and workers in Go from protobuf schemas. This plugin allows Workflow authors to configure sensible defaults and guardrails, simplifies the implementation and testing of Temporal workers, and streamlines integration by providing typed client SDKs and a generated CLI application.
Inspired by [Chad Retz's](https://github.com/cretz/) awesome [github.com/cretz/temporal-sdk-go-advanced](https://github.com/cretz/temporal-sdk-go-advanced) and [Jacob LeGrone's](https://github.com/jlegrone/) excellent Replay talk on [Temporal @ Datadog](https://youtu.be/LxgkAoTSI8Q)
## How it works
1. Annotate your protobuf services and methods with Temporal options provided by this plugin
2. Generate Go code that includes types, methods, and functions for implementing Temporal clients, workers, and cli applications
3. Define implementations for the required Workflow and Activity interfaces
4. Run your Temporal worker using the generated helpers and interact with it using the generated client and/or cli
## Features
Generated **Client** with:
- methods for executing workflows, queries, signals, and updates
- methods for cancelling or terminating workflows
- default `client.StartWorkflowOptions`, `client.UpdateWorkflowWithOptionsRequest`, and more
- dynamic workflow ids, update ids, and search attributes via [Bloblang expressions](https://cludden.github.io/protoc-gen-go-temporal/docs/guides/bloblang)
- default timeouts, id reuse policies, retry policies, wait policies, and more
Generated **Worker** resources with:
- functions for calling activities and local activities from workflows
- functions for executing child workflows and signaling external workflows
- default `workflow.ActivityOptions`, `workflow.ChildWorkflowOptions`
- default timeouts, parent close policies, retry policies, and more
Optional **CLI** with:
- commands for executing workflows, synchronously or asynchronously
- commands for starting workflows with signals or updates, synchronously or asynchronously
- commands for querying existing workflows
- commands for signaling or updating existing workflows
- typed flags for conveniently specifying workflow, query, and signal inputs
Generated **Nexus** helpers: **[Experimental]**
- with support for invoking a service's workflows via Nexus operations
Generated **Cross-Namespace (XNS)** helpers:
- with support for invoking a service's workflows, queries, signals, and updates from workflows in a different temporal namespace (or cluster)
Generated **Remote Codec Server** helpers
Generated **Markdown Documentation**
## Documentation
See the [documentation](https://cludden.github.io/protoc-gen-go-temporal/) for guides on how to configure and use this plugin.
## Development
1. Install [mise](https://mise.jdx.dev/installing-mise.html)
2. Update generated code
```shell
mise r build && mise r genlocal
```
1. Run tests
```shell
mise r test
```
## License
Licensed under the [MIT License](LICENSE.md)
Copyright for portions of project cludden/protoc-gen-go-temporal are held by Chad Retz, 2021 as part of project cretz/temporal-sdk-go-advanced. All other copyright for project cludden/protoc-gen-go-temporal are held by Chris Ludden, 2026.