mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## 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)
23 lines
678 B
Cheetah
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{}
|
|
}
|
|
}
|