dispatcher.go ×3

Frontier kind: Code frontier

unlabeled · c_07600d3caad1

3 tests · 2463 LOC · 121 files · introduces 0 tests · 50 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges50 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
365 ranges2463 lines · 121 files · Browse complete extent
All tests (intent)
3 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 50 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/workercommands/dispatcher.go 42 introduced LOC · 3 ranges

Open complete file

96 }
97
98 > ctx, cancel := context.WithTimeout(ctx, DispatchTimeout) dispatcher.go
99 > defer cancel()
100 >
101 > return d.dispatchToWorker(ctx, task, namespaceName)
102 }
103
106 task *tasks.WorkerCommandsTask,
107 namespaceName string,
108 > ) error { dispatcher.go
109 > request := &workerservicepb.ExecuteCommandsRequest{
110 > Commands: task.Commands,
111 > }
112 > // Encode as binary/protobuf using the standard Temporal payload format.
113 > // Worker commands are handled directly by SDK Core (not by lang-SDK Nexus handlers),
114 > // so we use binary/protobuf which Core can decode natively via prost. The standard
115 > // payload.Encode() uses json/protobuf encoding, which Core does not support because
116 > // it normally delegates Nexus payload deserialization to the lang SDK.
117 > requestData, err := proto.Marshal(request)
118 > if err != nil {
119 return fmt.Errorf("failed to encode worker commands request: %w", err)
120 }
121 > requestPayload := &commonpb.Payload{ dispatcher.go
122 > Metadata: map[string][]byte{
123 > "encoding": []byte("binary/protobuf"),
124 > },
125 > Data: requestData,
126 > }
127 >
128 > nexusRequest := &nexuspb.Request{
129 > Header: map[string]string{},
130 > Variant: &nexuspb.Request_StartOperation{
131 > StartOperation: &nexuspb.StartOperationRequest{
132 > Service: ServiceName,
133 > Operation: OperationName,
134 > Payload: requestPayload,
135 > },
136 > },
137 > }
138 >
139 > resp, err := d.matchingClient.DispatchNexusTask(ctx, &matchingservice.DispatchNexusTaskRequest{
140 > NamespaceId: task.NamespaceID,
141 > TaskQueue: &taskqueuepb.TaskQueue{
142 > Name: task.Destination,
143 > Kind: enumspb.TASK_QUEUE_KIND_WORKER_COMMANDS,
144 > },
145 > Request: nexusRequest,
146 > })
147 > if err != nil {
148 d.recordCommandMetrics(task.Commands, namespaceName, "rpc_error")
149 return fmt.Errorf("failed to dispatch worker commands to control queue %s: %w", task.Destination, err)
go.temporal.io/server/api/matchingservicemock/v1/service_grpc.pb.mock.go 8 introduced LOC · 2 ranges

Open complete file

344
345 // DispatchNexusTask mocks base method.
346 > func (m *MockMatchingServiceClient) DispatchNexusTask(ctx context.Context, in *matchingservice.DispatchNexusTaskRequest, opts ...grpc.CallOption) (*matchingservice.DispatchNexusTaskResponse, error) { service_grpc.pb.mock.go
347 > m.ctrl.T.Helper()
348 > varargs := []any{ctx, in}
349 > for _, a := range opts {
350 varargs = append(varargs, a)
351 }
352 > ret := m.ctrl.Call(m, "DispatchNexusTask", varargs...) service_grpc.pb.mock.go
353 > ret0, _ := ret[0].(*matchingservice.DispatchNexusTaskResponse)
354 > ret1, _ := ret[1].(error)
355 > return ret0, ret1
356 }
357