Files
Yichao YangandGitHub ebb3629539 Codegen for routingKey extractor (#9836)
## What changed?
- Codegen to automatically generate code for extracting businessID for
workflowservice methods based on "temporal-resouce-id" proto option

## Why?
- With codegen, any new API will automatically have the logic for
businessID extraction and avoids the case where businessID extractor
logic forget to be updated.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [x] added new unit test(s)
- [ ] added new functional test(s)
2026-05-01 17:56:10 -07:00

23 lines
678 B
Cheetah

// Code generated by genroutingkeyextractor. DO NOT EDIT.
package interceptor
import (
"go.temporal.io/api/workflowservice/v1"
"go.temporal.io/server/common/namespace"
)
// workflowServiceRequestRoutingKey extracts the routing key
// from a WorkflowService request using field paths declared in the
// temporal.api.protometa.v1.request_header proto annotation.
func workflowServiceRequestRoutingKey(req any) namespace.RoutingKey {
switch r := req.(type) {
{{- range .Methods}}
case *workflowservice.{{.RequestType}}:
return namespace.RoutingKey{ID: {{.Accessor}}{{if .Strategy}}, Strategy: {{.Strategy}}{{end}}}
{{- end}}
default:
return namespace.RoutingKey{}
}
}