• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / cadence-java-client / 2428

11 Jul 2024 09:55PM UTC coverage: 61.938% (+0.5%) from 61.478%
2428

push

buildkite

web-flow
Use the same Request ID for retries (#915)

Currently the RequestId is initialized in the implementation of IWorkflowService (either Thrift2ProtoAdapter or WorkflowServiceTChannel). Since retries are handled within GenericWorkflowClientExternalImpl, each retry uses a different request ID. This causes Cadence's idempotency feature not to work correctly for retries from the Java client.

Move Request ID initialization to GenericWorkflowClientExternalImpl, and for backwards compatibility (since users may be interacting with the IWorkflowService directly) continue setting the request ID if not specified.

14 of 27 new or added lines in 3 files covered. (51.85%)

13 existing lines in 5 files now uncovered.

12071 of 19489 relevant lines covered (61.94%)

0.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

4.11
/src/main/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapter.java
1
/*
2
 *  Modifications Copyright (c) 2017-2021 Uber Technologies Inc.
3
 *  Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
 *
5
 *  Licensed under the Apache License, Version 2.0 (the "License"). You may not
6
 *  use this file except in compliance with the License. A copy of the License is
7
 *  located at
8
 *
9
 *  http://aws.amazon.com/apache2.0
10
 *
11
 *  or in the "license" file accompanying this file. This file is distributed on
12
 *  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
 *  express or implied. See the License for the specific language governing
14
 *  permissions and limitations under the License.
15
 */
16
package com.uber.cadence.internal.compatibility;
17

18
import com.google.common.util.concurrent.FutureCallback;
19
import com.google.common.util.concurrent.Futures;
20
import com.google.common.util.concurrent.ListenableFuture;
21
import com.uber.cadence.BadRequestError;
22
import com.uber.cadence.CancellationAlreadyRequestedError;
23
import com.uber.cadence.ClientVersionNotSupportedError;
24
import com.uber.cadence.ClusterInfo;
25
import com.uber.cadence.CountWorkflowExecutionsRequest;
26
import com.uber.cadence.CountWorkflowExecutionsResponse;
27
import com.uber.cadence.DeprecateDomainRequest;
28
import com.uber.cadence.DescribeDomainRequest;
29
import com.uber.cadence.DescribeDomainResponse;
30
import com.uber.cadence.DescribeTaskListRequest;
31
import com.uber.cadence.DescribeTaskListResponse;
32
import com.uber.cadence.DescribeWorkflowExecutionRequest;
33
import com.uber.cadence.DescribeWorkflowExecutionResponse;
34
import com.uber.cadence.DomainAlreadyExistsError;
35
import com.uber.cadence.DomainNotActiveError;
36
import com.uber.cadence.EntityNotExistsError;
37
import com.uber.cadence.GetSearchAttributesResponse;
38
import com.uber.cadence.GetTaskListsByDomainRequest;
39
import com.uber.cadence.GetTaskListsByDomainResponse;
40
import com.uber.cadence.GetWorkflowExecutionHistoryRequest;
41
import com.uber.cadence.GetWorkflowExecutionHistoryResponse;
42
import com.uber.cadence.InternalServiceError;
43
import com.uber.cadence.LimitExceededError;
44
import com.uber.cadence.ListArchivedWorkflowExecutionsRequest;
45
import com.uber.cadence.ListArchivedWorkflowExecutionsResponse;
46
import com.uber.cadence.ListClosedWorkflowExecutionsRequest;
47
import com.uber.cadence.ListClosedWorkflowExecutionsResponse;
48
import com.uber.cadence.ListDomainsRequest;
49
import com.uber.cadence.ListDomainsResponse;
50
import com.uber.cadence.ListOpenWorkflowExecutionsRequest;
51
import com.uber.cadence.ListOpenWorkflowExecutionsResponse;
52
import com.uber.cadence.ListTaskListPartitionsRequest;
53
import com.uber.cadence.ListTaskListPartitionsResponse;
54
import com.uber.cadence.ListWorkflowExecutionsRequest;
55
import com.uber.cadence.ListWorkflowExecutionsResponse;
56
import com.uber.cadence.PollForActivityTaskRequest;
57
import com.uber.cadence.PollForActivityTaskResponse;
58
import com.uber.cadence.PollForDecisionTaskRequest;
59
import com.uber.cadence.PollForDecisionTaskResponse;
60
import com.uber.cadence.QueryFailedError;
61
import com.uber.cadence.QueryWorkflowRequest;
62
import com.uber.cadence.QueryWorkflowResponse;
63
import com.uber.cadence.RecordActivityTaskHeartbeatByIDRequest;
64
import com.uber.cadence.RecordActivityTaskHeartbeatRequest;
65
import com.uber.cadence.RecordActivityTaskHeartbeatResponse;
66
import com.uber.cadence.RefreshWorkflowTasksRequest;
67
import com.uber.cadence.RegisterDomainRequest;
68
import com.uber.cadence.RequestCancelWorkflowExecutionRequest;
69
import com.uber.cadence.ResetStickyTaskListRequest;
70
import com.uber.cadence.ResetStickyTaskListResponse;
71
import com.uber.cadence.ResetWorkflowExecutionRequest;
72
import com.uber.cadence.ResetWorkflowExecutionResponse;
73
import com.uber.cadence.RespondActivityTaskCanceledByIDRequest;
74
import com.uber.cadence.RespondActivityTaskCanceledRequest;
75
import com.uber.cadence.RespondActivityTaskCompletedByIDRequest;
76
import com.uber.cadence.RespondActivityTaskCompletedRequest;
77
import com.uber.cadence.RespondActivityTaskFailedByIDRequest;
78
import com.uber.cadence.RespondActivityTaskFailedRequest;
79
import com.uber.cadence.RespondDecisionTaskCompletedRequest;
80
import com.uber.cadence.RespondDecisionTaskCompletedResponse;
81
import com.uber.cadence.RespondDecisionTaskFailedRequest;
82
import com.uber.cadence.RespondQueryTaskCompletedRequest;
83
import com.uber.cadence.RestartWorkflowExecutionRequest;
84
import com.uber.cadence.RestartWorkflowExecutionResponse;
85
import com.uber.cadence.ServiceBusyError;
86
import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncRequest;
87
import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncResponse;
88
import com.uber.cadence.SignalWithStartWorkflowExecutionRequest;
89
import com.uber.cadence.SignalWorkflowExecutionRequest;
90
import com.uber.cadence.StartWorkflowExecutionAsyncRequest;
91
import com.uber.cadence.StartWorkflowExecutionAsyncResponse;
92
import com.uber.cadence.StartWorkflowExecutionRequest;
93
import com.uber.cadence.StartWorkflowExecutionResponse;
94
import com.uber.cadence.TerminateWorkflowExecutionRequest;
95
import com.uber.cadence.UpdateDomainRequest;
96
import com.uber.cadence.UpdateDomainResponse;
97
import com.uber.cadence.WorkflowExecutionAlreadyCompletedError;
98
import com.uber.cadence.WorkflowExecutionAlreadyStartedError;
99
import com.uber.cadence.api.v1.GetSearchAttributesRequest;
100
import com.uber.cadence.api.v1.HealthRequest;
101
import com.uber.cadence.api.v1.HealthResponse;
102
import com.uber.cadence.internal.compatibility.proto.RequestMapper;
103
import com.uber.cadence.internal.compatibility.proto.serviceclient.IGrpcServiceStubs;
104
import com.uber.cadence.internal.compatibility.thrift.ErrorMapper;
105
import com.uber.cadence.internal.compatibility.thrift.ResponseMapper;
106
import com.uber.cadence.serviceclient.ClientOptions;
107
import com.uber.cadence.serviceclient.IWorkflowService;
108
import io.grpc.Deadline;
109
import io.grpc.StatusRuntimeException;
110
import java.util.UUID;
111
import java.util.concurrent.CompletableFuture;
112
import java.util.concurrent.ForkJoinPool;
113
import java.util.concurrent.TimeUnit;
114
import org.apache.thrift.TException;
115
import org.apache.thrift.async.AsyncMethodCallback;
116

117
public class Thrift2ProtoAdapter implements IWorkflowService {
118

119
  IGrpcServiceStubs grpcServiceStubs;
120

121
  public Thrift2ProtoAdapter(IGrpcServiceStubs grpcServiceStubs) {
1✔
122
    this.grpcServiceStubs = grpcServiceStubs;
1✔
123
  }
1✔
124

125
  @Override
126
  public ClientOptions getOptions() {
127
    return grpcServiceStubs.getOptions();
×
128
  }
129

130
  @Override
131
  public void RegisterDomain(RegisterDomainRequest registerRequest)
132
      throws BadRequestError, DomainAlreadyExistsError, ServiceBusyError,
133
          ClientVersionNotSupportedError, TException {
134
    try {
135
      grpcServiceStubs
×
136
          .domainBlockingStub()
×
137
          .registerDomain(RequestMapper.registerDomainRequest(registerRequest));
×
138
    } catch (StatusRuntimeException e) {
×
139
      throw ErrorMapper.Error(e);
×
140
    }
×
141
  }
×
142

143
  @Override
144
  public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest)
145
      throws BadRequestError, EntityNotExistsError, ServiceBusyError,
146
          ClientVersionNotSupportedError, TException {
147
    try {
148
      com.uber.cadence.api.v1.DescribeDomainResponse response =
×
149
          grpcServiceStubs
150
              .domainBlockingStub()
×
151
              .describeDomain(RequestMapper.describeDomainRequest(describeRequest));
×
152
      return ResponseMapper.describeDomainResponse(response);
×
153
    } catch (StatusRuntimeException e) {
×
154
      throw ErrorMapper.Error(e);
×
155
    }
156
  }
157

158
  @Override
159
  public ListDomainsResponse ListDomains(ListDomainsRequest listRequest)
160
      throws BadRequestError, EntityNotExistsError, ServiceBusyError,
161
          ClientVersionNotSupportedError, TException {
162
    try {
163
      com.uber.cadence.api.v1.ListDomainsResponse response =
×
164
          grpcServiceStubs
165
              .domainBlockingStub()
×
166
              .listDomains(RequestMapper.listDomainsRequest(listRequest));
×
167
      return ResponseMapper.listDomainsResponse(response);
×
168
    } catch (StatusRuntimeException e) {
×
169
      throw ErrorMapper.Error(e);
×
170
    }
171
  }
172

173
  @Override
174
  public UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest)
175
      throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError,
176
          ClientVersionNotSupportedError, TException {
177
    try {
178
      com.uber.cadence.api.v1.UpdateDomainResponse response =
×
179
          grpcServiceStubs
180
              .domainBlockingStub()
×
181
              .updateDomain(RequestMapper.updateDomainRequest(updateRequest));
×
182
      return ResponseMapper.updateDomainResponse(response);
×
183
    } catch (StatusRuntimeException e) {
×
184
      throw ErrorMapper.Error(e);
×
185
    }
186
  }
187

188
  @Override
189
  public void DeprecateDomain(DeprecateDomainRequest deprecateRequest)
190
      throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError,
191
          ClientVersionNotSupportedError, TException {
192
    try {
193
      grpcServiceStubs
×
194
          .domainBlockingStub()
×
195
          .deprecateDomain(RequestMapper.deprecateDomainRequest(deprecateRequest));
×
196
    } catch (StatusRuntimeException e) {
×
197
      throw ErrorMapper.Error(e);
×
198
    }
×
199
  }
×
200

201
  @Override
202
  public RestartWorkflowExecutionResponse RestartWorkflowExecution(
203
      RestartWorkflowExecutionRequest restartRequest)
204
      throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError,
205
          EntityNotExistsError, ClientVersionNotSupportedError, TException {
206
    throw new IllegalArgumentException("unimplemented");
×
207
  }
208

209
  @Override
210
  public StartWorkflowExecutionResponse StartWorkflowExecution(
211
      StartWorkflowExecutionRequest startRequest)
212
      throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError,
213
          DomainNotActiveError, LimitExceededError, EntityNotExistsError,
214
          ClientVersionNotSupportedError, TException {
215
    return startWorkflowExecution(startRequest);
×
216
  }
217

218
  @Override
219
  public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync(
220
      StartWorkflowExecutionAsyncRequest startRequest)
221
      throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError,
222
          DomainNotActiveError, LimitExceededError, EntityNotExistsError,
223
          ClientVersionNotSupportedError, TException {
224
    initializeStartWorkflowExecutionRequest(startRequest.getRequest());
1✔
225
    try {
226
      com.uber.cadence.api.v1.StartWorkflowExecutionAsyncResponse response =
1✔
227
          grpcServiceStubs
228
              .workflowBlockingStub()
1✔
229
              .startWorkflowExecutionAsync(
1✔
230
                  RequestMapper.startWorkflowExecutionAsyncRequest(startRequest));
1✔
231
      return ResponseMapper.startWorkflowExecutionAsyncResponse(response);
1✔
232
    } catch (StatusRuntimeException e) {
×
233
      throw ErrorMapper.Error(e);
×
234
    }
235
  }
236

237
  private StartWorkflowExecutionResponse startWorkflowExecution(
238
      StartWorkflowExecutionRequest startRequest)
239
      throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError,
240
          DomainNotActiveError, LimitExceededError, EntityNotExistsError,
241
          ClientVersionNotSupportedError, TException {
242
    initializeStartWorkflowExecutionRequest(startRequest);
×
243
    try {
244
      com.uber.cadence.api.v1.StartWorkflowExecutionResponse response =
×
245
          grpcServiceStubs
246
              .workflowBlockingStub()
×
247
              .startWorkflowExecution(RequestMapper.startWorkflowExecutionRequest(startRequest));
×
248
      return ResponseMapper.startWorkflowExecutionResponse(response);
×
249
    } catch (StatusRuntimeException e) {
×
250
      throw ErrorMapper.Error(e);
×
251
    }
252
  }
253

254
  private void initializeStartWorkflowExecutionRequest(StartWorkflowExecutionRequest request) {
255
    if (!request.isSetRequestId()) {
1✔
NEW
256
      request.setRequestId(UUID.randomUUID().toString());
×
257
    }
258
  }
1✔
259

260
  @Override
261
  public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory(
262
      GetWorkflowExecutionHistoryRequest getRequest)
263
      throws BadRequestError, EntityNotExistsError, ServiceBusyError,
264
          ClientVersionNotSupportedError, TException {
265
    try {
266
      com.uber.cadence.api.v1.GetWorkflowExecutionHistoryResponse response =
×
267
          grpcServiceStubs
268
              .workflowBlockingStub()
×
269
              .getWorkflowExecutionHistory(
×
270
                  RequestMapper.getWorkflowExecutionHistoryRequest(getRequest));
×
271
      return ResponseMapper.getWorkflowExecutionHistoryResponse(response);
×
272
    } catch (StatusRuntimeException e) {
×
273
      throw ErrorMapper.Error(e);
×
274
    }
275
  }
276

277
  @Override
278
  public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest pollRequest)
279
      throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError,
280
          DomainNotActiveError, ClientVersionNotSupportedError, TException {
281
    try {
282
      com.uber.cadence.api.v1.PollForDecisionTaskResponse response =
×
283
          grpcServiceStubs
284
              .workerBlockingStub()
×
285
              .pollForDecisionTask(RequestMapper.pollForDecisionTaskRequest(pollRequest));
×
286
      return ResponseMapper.pollForDecisionTaskResponse(response);
×
287
    } catch (StatusRuntimeException e) {
×
288
      throw ErrorMapper.Error(e);
×
289
    }
290
  }
291

292
  @Override
293
  public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted(
294
      RespondDecisionTaskCompletedRequest completeRequest)
295
      throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError,
296
          ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError,
297
          TException {
298
    try {
299
      com.uber.cadence.api.v1.RespondDecisionTaskCompletedResponse response =
×
300
          grpcServiceStubs
301
              .workerBlockingStub()
×
302
              .respondDecisionTaskCompleted(
×
303
                  RequestMapper.respondDecisionTaskCompletedRequest(completeRequest));
×
304
      return ResponseMapper.respondDecisionTaskCompletedResponse(response);
×
305
    } catch (StatusRuntimeException e) {
×
306
      throw ErrorMapper.Error(e);
×
307
    }
308
  }
309

310
  @Override
311
  public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest)
312
      throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError,
313
          ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError,
314
          TException {
315
    try {
316
      grpcServiceStubs
×
317
          .workerBlockingStub()
×
318
          .respondDecisionTaskFailed(RequestMapper.respondDecisionTaskFailedRequest(failedRequest));
×
319
    } catch (StatusRuntimeException e) {
×
320
      throw ErrorMapper.Error(e);
×
321
    }
×
322
  }
×
323

324
  @Override
325
  public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest pollRequest)
326
      throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError,
327
          DomainNotActiveError, ClientVersionNotSupportedError, TException {
328
    try {
329
      com.uber.cadence.api.v1.PollForActivityTaskResponse response =
×
330
          grpcServiceStubs
331
              .workerBlockingStub()
×
332
              .pollForActivityTask(RequestMapper.pollForActivityTaskRequest(pollRequest));
×
333
      return ResponseMapper.pollForActivityTaskResponse(response);
×
334
    } catch (StatusRuntimeException e) {
×
335
      throw ErrorMapper.Error(e);
×
336
    }
337
  }
338

339
  @Override
340
  public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(
341
      RecordActivityTaskHeartbeatRequest heartbeatRequest)
342
      throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError,
343
          ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError,
344
          TException {
345
    try {
346
      com.uber.cadence.api.v1.RecordActivityTaskHeartbeatResponse response =
×
347
          grpcServiceStubs
348
              .workerBlockingStub()
×
349
              .recordActivityTaskHeartbeat(
×
350
                  RequestMapper.recordActivityTaskHeartbeatRequest(heartbeatRequest));
×
351
      return ResponseMapper.recordActivityTaskHeartbeatResponse(response);
×
352
    } catch (StatusRuntimeException e) {
×
353
      throw ErrorMapper.Error(e);
×
354
    }
355
  }
356

357
  @Override
358
  public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID(
359
      RecordActivityTaskHeartbeatByIDRequest heartbeatRequest)
360
      throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError,
361
          ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError,
362
          TException {
363
    try {
364
      com.uber.cadence.api.v1.RecordActivityTaskHeartbeatByIDResponse response =
×
365
          grpcServiceStubs
366
              .workerBlockingStub()
×
367
              .recordActivityTaskHeartbeatByID(
×
368
                  RequestMapper.recordActivityTaskHeartbeatByIdRequest(heartbeatRequest));
×
369
      return ResponseMapper.recordActivityTaskHeartbeatByIdResponse(response);
×
370
    } catch (StatusRuntimeException e) {
×
371
      throw ErrorMapper.Error(e);
×
372
    }
373
  }
374

375
  @Override
376
  public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest)
377
      throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError,
378
          ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError,
379
          TException {
380
    try {
381
      grpcServiceStubs
×
382
          .workerBlockingStub()
×
383
          .respondActivityTaskCompleted(
×
384
              RequestMapper.respondActivityTaskCompletedRequest(completeRequest));
×
385
    } catch (StatusRuntimeException e) {
×
386
      throw ErrorMapper.Error(e);
×
387
    }
×
388
  }
×
389

390
  @Override
391
  public void RespondActivityTaskCompletedByID(
392
      RespondActivityTaskCompletedByIDRequest completeRequest)
393
      throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError,
394
          ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError,
395
          TException {
396
    try {
397
      grpcServiceStubs
×
398
          .workerBlockingStub()
×
399
          .respondActivityTaskCompletedByID(
×
400
              RequestMapper.respondActivityTaskCompletedByIdRequest(completeRequest));
×
401
    } catch (StatusRuntimeException e) {
×
402
      throw ErrorMapper.Error(e);
×
403
    }
×
404
  }
×
405

406
  @Override
407
  public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest)
408
      throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError,
409
          ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError,
410
          TException {
411
    try {
412
      grpcServiceStubs
×
413
          .workerBlockingStub()
×
414
          .respondActivityTaskFailed(RequestMapper.respondActivityTaskFailedRequest(failRequest));
×
415
    } catch (StatusRuntimeException e) {
×
416
      throw ErrorMapper.Error(e);
×
417
    }
×
418
  }
×
419

420
  @Override
421
  public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest)
422
      throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError,
423
          ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError,
424
          TException {
425
    try {
426
      grpcServiceStubs
×
427
          .workerBlockingStub()
×
428
          .respondActivityTaskFailedByID(
×
429
              RequestMapper.respondActivityTaskFailedByIdRequest(failRequest));
×
430
    } catch (StatusRuntimeException e) {
×
431
      throw ErrorMapper.Error(e);
×
432
    }
×
433
  }
×
434

435
  @Override
436
  public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest)
437
      throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError,
438
          ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError,
439
          TException {
440
    try {
441
      grpcServiceStubs
×
442
          .workerBlockingStub()
×
443
          .respondActivityTaskCanceled(
×
444
              RequestMapper.respondActivityTaskCanceledRequest(canceledRequest));
×
445
    } catch (StatusRuntimeException e) {
×
446
      throw ErrorMapper.Error(e);
×
447
    }
×
448
  }
×
449

450
  @Override
451
  public void RespondActivityTaskCanceledByID(
452
      RespondActivityTaskCanceledByIDRequest canceledRequest)
453
      throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError,
454
          ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError,
455
          TException {
456
    try {
457
      grpcServiceStubs
×
458
          .workerBlockingStub()
×
459
          .respondActivityTaskCanceledByID(
×
460
              RequestMapper.respondActivityTaskCanceledByIdRequest(canceledRequest));
×
461
    } catch (StatusRuntimeException e) {
×
462
      throw ErrorMapper.Error(e);
×
463
    }
×
464
  }
×
465

466
  @Override
467
  public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest)
468
      throws BadRequestError, EntityNotExistsError, CancellationAlreadyRequestedError,
469
          ServiceBusyError, DomainNotActiveError, LimitExceededError,
470
          ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, TException {
NEW
471
    if (!cancelRequest.isSetRequestId()) {
×
NEW
472
      cancelRequest.setRequestId(UUID.randomUUID().toString());
×
473
    }
474
    try {
475
      grpcServiceStubs
×
476
          .workflowBlockingStub()
×
477
          .requestCancelWorkflowExecution(
×
478
              RequestMapper.requestCancelWorkflowExecutionRequest(cancelRequest));
×
479
    } catch (StatusRuntimeException e) {
×
480
      throw ErrorMapper.Error(e);
×
481
    }
×
482
  }
×
483

484
  @Override
485
  public void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest)
486
      throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError,
487
          LimitExceededError, ClientVersionNotSupportedError,
488
          WorkflowExecutionAlreadyCompletedError, TException {
NEW
489
    if (!signalRequest.isSetRequestId()) {
×
NEW
490
      signalRequest.setRequestId(UUID.randomUUID().toString());
×
491
    }
492
    try {
493
      grpcServiceStubs
×
494
          .workflowBlockingStub()
×
495
          .signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest));
×
496
    } catch (StatusRuntimeException e) {
×
497
      throw ErrorMapper.Error(e);
×
498
    }
×
499
  }
×
500

501
  @Override
502
  public StartWorkflowExecutionResponse SignalWithStartWorkflowExecution(
503
      SignalWithStartWorkflowExecutionRequest signalWithStartRequest)
504
      throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError,
505
          LimitExceededError, WorkflowExecutionAlreadyStartedError, ClientVersionNotSupportedError,
506
          TException {
507
    try {
508
      initializeSignalWithStartWorkflowExecution(signalWithStartRequest);
×
509
      com.uber.cadence.api.v1.SignalWithStartWorkflowExecutionResponse response =
×
510
          grpcServiceStubs
511
              .workflowBlockingStub()
×
512
              .signalWithStartWorkflowExecution(
×
513
                  RequestMapper.signalWithStartWorkflowExecutionRequest(signalWithStartRequest));
×
514
      return ResponseMapper.signalWithStartWorkflowExecutionResponse(response);
×
515
    } catch (StatusRuntimeException e) {
×
516
      throw ErrorMapper.Error(e);
×
517
    }
518
  }
519

520
  @Override
521
  public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExecutionAsync(
522
      SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest)
523
      throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError,
524
          DomainNotActiveError, LimitExceededError, EntityNotExistsError,
525
          ClientVersionNotSupportedError, TException {
526
    try {
527
      initializeSignalWithStartWorkflowExecution(signalWithStartRequest.getRequest());
1✔
528
      com.uber.cadence.api.v1.SignalWithStartWorkflowExecutionAsyncResponse response =
1✔
529
          grpcServiceStubs
530
              .workflowBlockingStub()
1✔
531
              .signalWithStartWorkflowExecutionAsync(
1✔
532
                  RequestMapper.signalWithStartWorkflowExecutionAsyncRequest(
1✔
533
                      signalWithStartRequest));
534
      return ResponseMapper.signalWithStartWorkflowExecutionAsyncResponse(response);
1✔
535
    } catch (StatusRuntimeException e) {
×
536
      throw ErrorMapper.Error(e);
×
537
    }
538
  }
539

540
  private void initializeSignalWithStartWorkflowExecution(
541
      SignalWithStartWorkflowExecutionRequest request) {
542
    if (!request.isSetRequestId()) {
1✔
NEW
543
      request.setRequestId(UUID.randomUUID().toString());
×
544
    }
545
  }
1✔
546

547
  @Override
548
  public ResetWorkflowExecutionResponse ResetWorkflowExecution(
549
      ResetWorkflowExecutionRequest resetRequest)
550
      throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError,
551
          LimitExceededError, ClientVersionNotSupportedError, TException {
552
    try {
NEW
553
      if (!resetRequest.isSetRequestId()) {
×
NEW
554
        resetRequest.setRequestId(UUID.randomUUID().toString());
×
555
      }
UNCOV
556
      com.uber.cadence.api.v1.ResetWorkflowExecutionResponse response =
×
557
          grpcServiceStubs
558
              .workflowBlockingStub()
×
559
              .resetWorkflowExecution(RequestMapper.resetWorkflowExecutionRequest(resetRequest));
×
560
      return ResponseMapper.resetWorkflowExecutionResponse(response);
×
561
    } catch (StatusRuntimeException e) {
×
562
      throw ErrorMapper.Error(e);
×
563
    }
564
  }
565

566
  @Override
567
  public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest)
568
      throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError,
569
          LimitExceededError, ClientVersionNotSupportedError,
570
          WorkflowExecutionAlreadyCompletedError, TException {
571
    try {
572
      grpcServiceStubs
×
573
          .workflowBlockingStub()
×
574
          .terminateWorkflowExecution(
×
575
              RequestMapper.terminateWorkflowExecutionRequest(terminateRequest));
×
576
    } catch (StatusRuntimeException e) {
×
577
      throw ErrorMapper.Error(e);
×
578
    }
×
579
  }
×
580

581
  @Override
582
  public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions(
583
      ListOpenWorkflowExecutionsRequest listRequest)
584
      throws BadRequestError, EntityNotExistsError, ServiceBusyError, LimitExceededError,
585
          ClientVersionNotSupportedError, TException {
586
    try {
587
      com.uber.cadence.api.v1.ListOpenWorkflowExecutionsResponse response =
×
588
          grpcServiceStubs
589
              .visibilityBlockingStub()
×
590
              .listOpenWorkflowExecutions(
×
591
                  RequestMapper.listOpenWorkflowExecutionsRequest(listRequest));
×
592
      return ResponseMapper.listOpenWorkflowExecutionsResponse(response);
×
593
    } catch (StatusRuntimeException e) {
×
594
      throw ErrorMapper.Error(e);
×
595
    }
596
  }
597

598
  @Override
599
  public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions(
600
      ListClosedWorkflowExecutionsRequest listRequest)
601
      throws BadRequestError, EntityNotExistsError, ServiceBusyError,
602
          ClientVersionNotSupportedError, TException {
603
    try {
604
      com.uber.cadence.api.v1.ListClosedWorkflowExecutionsResponse response =
×
605
          grpcServiceStubs
606
              .visibilityBlockingStub()
×
607
              .listClosedWorkflowExecutions(
×
608
                  RequestMapper.listClosedWorkflowExecutionsRequest(listRequest));
×
609
      return ResponseMapper.listClosedWorkflowExecutionsResponse(response);
×
610
    } catch (StatusRuntimeException e) {
×
611
      throw ErrorMapper.Error(e);
×
612
    }
613
  }
614

615
  @Override
616
  public ListWorkflowExecutionsResponse ListWorkflowExecutions(
617
      ListWorkflowExecutionsRequest listRequest)
618
      throws BadRequestError, EntityNotExistsError, ServiceBusyError,
619
          ClientVersionNotSupportedError, TException {
620
    try {
621
      com.uber.cadence.api.v1.ListWorkflowExecutionsResponse response =
×
622
          grpcServiceStubs
623
              .visibilityBlockingStub()
×
624
              .listWorkflowExecutions(RequestMapper.listWorkflowExecutionsRequest(listRequest));
×
625
      return ResponseMapper.listWorkflowExecutionsResponse(response);
×
626
    } catch (StatusRuntimeException e) {
×
627
      throw ErrorMapper.Error(e);
×
628
    }
629
  }
630

631
  @Override
632
  public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions(
633
      ListArchivedWorkflowExecutionsRequest listRequest)
634
      throws BadRequestError, EntityNotExistsError, ServiceBusyError,
635
          ClientVersionNotSupportedError, TException {
636
    try {
637
      com.uber.cadence.api.v1.ListArchivedWorkflowExecutionsResponse response =
×
638
          grpcServiceStubs
639
              .visibilityBlockingStub()
×
640
              .listArchivedWorkflowExecutions(
×
641
                  RequestMapper.listArchivedWorkflowExecutionsRequest(listRequest));
×
642
      return ResponseMapper.listArchivedWorkflowExecutionsResponse(response);
×
643
    } catch (StatusRuntimeException e) {
×
644
      throw ErrorMapper.Error(e);
×
645
    }
646
  }
647

648
  @Override
649
  public ListWorkflowExecutionsResponse ScanWorkflowExecutions(
650
      ListWorkflowExecutionsRequest listRequest)
651
      throws BadRequestError, EntityNotExistsError, ServiceBusyError,
652
          ClientVersionNotSupportedError, TException {
653
    try {
654
      com.uber.cadence.api.v1.ScanWorkflowExecutionsResponse response =
×
655
          grpcServiceStubs
656
              .visibilityBlockingStub()
×
657
              .scanWorkflowExecutions(RequestMapper.scanWorkflowExecutionsRequest(listRequest));
×
658
      return ResponseMapper.scanWorkflowExecutionsResponse(response);
×
659
    } catch (StatusRuntimeException e) {
×
660
      throw ErrorMapper.Error(e);
×
661
    }
662
  }
663

664
  @Override
665
  public CountWorkflowExecutionsResponse CountWorkflowExecutions(
666
      CountWorkflowExecutionsRequest countRequest)
667
      throws BadRequestError, EntityNotExistsError, ServiceBusyError,
668
          ClientVersionNotSupportedError, TException {
669
    try {
670
      com.uber.cadence.api.v1.CountWorkflowExecutionsResponse response =
×
671
          grpcServiceStubs
672
              .visibilityBlockingStub()
×
673
              .countWorkflowExecutions(RequestMapper.countWorkflowExecutionsRequest(countRequest));
×
674
      return ResponseMapper.countWorkflowExecutionsResponse(response);
×
675
    } catch (StatusRuntimeException e) {
×
676
      throw ErrorMapper.Error(e);
×
677
    }
678
  }
679

680
  @Override
681
  public GetSearchAttributesResponse GetSearchAttributes()
682
      throws ServiceBusyError, ClientVersionNotSupportedError, TException {
683
    try {
684
      com.uber.cadence.api.v1.GetSearchAttributesResponse response =
×
685
          grpcServiceStubs
686
              .visibilityBlockingStub()
×
687
              .getSearchAttributes(GetSearchAttributesRequest.newBuilder().build());
×
688
      return ResponseMapper.getSearchAttributesResponse(response);
×
689
    } catch (StatusRuntimeException e) {
×
690
      throw ErrorMapper.Error(e);
×
691
    }
692
  }
693

694
  @Override
695
  public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest)
696
      throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError,
697
          DomainNotActiveError, ClientVersionNotSupportedError, TException {
698
    try {
699
      grpcServiceStubs
×
700
          .workerBlockingStub()
×
701
          .respondQueryTaskCompleted(
×
702
              RequestMapper.respondQueryTaskCompletedRequest(completeRequest));
×
703
    } catch (StatusRuntimeException e) {
×
704
      throw ErrorMapper.Error(e);
×
705
    }
×
706
  }
×
707

708
  @Override
709
  public ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest)
710
      throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError,
711
          DomainNotActiveError, ClientVersionNotSupportedError,
712
          WorkflowExecutionAlreadyCompletedError, TException {
713
    try {
714
      com.uber.cadence.api.v1.ResetStickyTaskListResponse response =
×
715
          grpcServiceStubs
716
              .workerBlockingStub()
×
717
              .resetStickyTaskList(RequestMapper.resetStickyTaskListRequest(resetRequest));
×
718
      return new ResetStickyTaskListResponse();
×
719
    } catch (StatusRuntimeException e) {
×
720
      throw ErrorMapper.Error(e);
×
721
    }
722
  }
723

724
  @Override
725
  public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest)
726
      throws BadRequestError, EntityNotExistsError, QueryFailedError, LimitExceededError,
727
          ServiceBusyError, ClientVersionNotSupportedError, TException {
728
    try {
729
      com.uber.cadence.api.v1.QueryWorkflowResponse response =
×
730
          grpcServiceStubs
731
              .workflowBlockingStub()
×
732
              .queryWorkflow(RequestMapper.queryWorkflowRequest(queryRequest));
×
733
      return ResponseMapper.queryWorkflowResponse(response);
×
734
    } catch (StatusRuntimeException e) {
×
735
      throw ErrorMapper.Error(e);
×
736
    }
737
  }
738

739
  @Override
740
  public DescribeWorkflowExecutionResponse DescribeWorkflowExecution(
741
      DescribeWorkflowExecutionRequest describeRequest)
742
      throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError,
743
          ClientVersionNotSupportedError, TException {
744
    try {
745
      com.uber.cadence.api.v1.DescribeWorkflowExecutionResponse response =
×
746
          grpcServiceStubs
747
              .workflowBlockingStub()
×
748
              .describeWorkflowExecution(
×
749
                  RequestMapper.describeWorkflowExecutionRequest(describeRequest));
×
750
      return ResponseMapper.describeWorkflowExecutionResponse(response);
×
751
    } catch (StatusRuntimeException e) {
×
752
      throw ErrorMapper.Error(e);
×
753
    }
754
  }
755

756
  @Override
757
  public DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request)
758
      throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError,
759
          ClientVersionNotSupportedError, TException {
760
    try {
761
      com.uber.cadence.api.v1.DescribeTaskListResponse response =
×
762
          grpcServiceStubs
763
              .workflowBlockingStub()
×
764
              .describeTaskList(RequestMapper.describeTaskListRequest(request));
×
765
      return ResponseMapper.describeTaskListResponse(response);
×
766
    } catch (StatusRuntimeException e) {
×
767
      throw ErrorMapper.Error(e);
×
768
    }
769
  }
770

771
  @Override
772
  public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, TException {
773
    try {
774
      com.uber.cadence.api.v1.GetClusterInfoResponse response =
×
775
          grpcServiceStubs
776
              .workflowBlockingStub()
×
777
              .getClusterInfo(com.uber.cadence.api.v1.GetClusterInfoRequest.newBuilder().build());
×
778
      return ResponseMapper.getClusterInfoResponse(response);
×
779
    } catch (StatusRuntimeException e) {
×
780
      throw ErrorMapper.Error(e);
×
781
    }
782
  }
783

784
  @Override
785
  public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainRequest request) {
786
    throw new UnsupportedOperationException("not implemented");
×
787
  }
788

789
  @Override
790
  public ListTaskListPartitionsResponse ListTaskListPartitions(
791
      ListTaskListPartitionsRequest request)
792
      throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError,
793
          TException {
794
    try {
795
      com.uber.cadence.api.v1.ListTaskListPartitionsResponse response =
×
796
          grpcServiceStubs
797
              .workflowBlockingStub()
×
798
              .listTaskListPartitions(RequestMapper.listTaskListPartitionsRequest(request));
×
799
      return ResponseMapper.listTaskListPartitionsResponse(response);
×
800
    } catch (StatusRuntimeException e) {
×
801
      throw ErrorMapper.Error(e);
×
802
    }
803
  }
804

805
  @Override
806
  public void RefreshWorkflowTasks(RefreshWorkflowTasksRequest request)
807
      throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError,
808
          TException {
809
    try {
810
      grpcServiceStubs
×
811
          .workflowBlockingStub()
×
812
          .refreshWorkflowTasks(
×
813
              com.uber.cadence.api.v1.RefreshWorkflowTasksRequest.newBuilder().build());
×
814
    } catch (StatusRuntimeException e) {
×
815
      throw ErrorMapper.Error(e);
×
816
    }
×
817
  }
×
818

819
  @Override
820
  public void RegisterDomain(
821
      RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) throws TException {
822
    throw new UnsupportedOperationException("not implemented");
×
823
  }
824

825
  @Override
826
  public void DescribeDomain(
827
      DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) throws TException {
828
    throw new UnsupportedOperationException("not implemented");
×
829
  }
830

831
  @Override
832
  public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler)
833
      throws TException {
834
    throw new UnsupportedOperationException("not implemented");
×
835
  }
836

837
  @Override
838
  public void UpdateDomain(UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler)
839
      throws TException {
840
    throw new UnsupportedOperationException("not implemented");
×
841
  }
842

843
  @Override
844
  public void DeprecateDomain(
845
      DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler)
846
      throws TException {
847
    throw new UnsupportedOperationException("not implemented");
×
848
  }
849

850
  @Override
851
  public void RestartWorkflowExecution(
852
      RestartWorkflowExecutionRequest restartRequest, AsyncMethodCallback resultHandler)
853
      throws TException {
854
    throw new IllegalArgumentException("unimplemented");
×
855
  }
856

857
  @Override
858
  public void StartWorkflowExecution(
859
      StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler)
860
      throws TException {
861
    throw new UnsupportedOperationException("not implemented");
×
862
  }
863

864
  @Override
865
  public void StartWorkflowExecutionAsync(
866
      StartWorkflowExecutionAsyncRequest startRequest, AsyncMethodCallback resultHandler)
867
      throws TException {
868
    try {
869
      initializeStartWorkflowExecutionRequest(startRequest.getRequest());
×
870
      ListenableFuture<com.uber.cadence.api.v1.StartWorkflowExecutionAsyncResponse> resultFuture =
×
871
          grpcServiceStubs
872
              .workflowFutureStub()
×
873
              .startWorkflowExecutionAsync(
×
874
                  RequestMapper.startWorkflowExecutionAsyncRequest(startRequest));
×
875
      resultFuture.addListener(
×
876
          () -> {
877
            try {
878
              com.uber.cadence.api.v1.StartWorkflowExecutionAsyncResponse response =
×
879
                  resultFuture.get();
×
880
              resultHandler.onComplete(
×
881
                  ResponseMapper.startWorkflowExecutionAsyncResponse(response));
×
882
            } catch (Exception e) {
×
883
              resultHandler.onError(e);
×
884
            }
×
885
          },
×
886
          ForkJoinPool.commonPool());
×
887
    } catch (StatusRuntimeException e) {
×
888
      throw ErrorMapper.Error(e);
×
889
    }
×
890
  }
×
891

892
  @Override
893
  public void GetWorkflowExecutionHistory(
894
      GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler)
895
      throws TException {
896
    throw new UnsupportedOperationException("not implemented");
×
897
  }
898

899
  @Override
900
  public void PollForDecisionTask(
901
      PollForDecisionTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws TException {
902
    throw new UnsupportedOperationException("not implemented");
×
903
  }
904

905
  @Override
906
  public void RespondDecisionTaskCompleted(
907
      RespondDecisionTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler)
908
      throws TException {
909
    throw new UnsupportedOperationException("not implemented");
×
910
  }
911

912
  @Override
913
  public void RespondDecisionTaskFailed(
914
      RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler)
915
      throws TException {
916
    throw new UnsupportedOperationException("not implemented");
×
917
  }
918

919
  @Override
920
  public void PollForActivityTask(
921
      PollForActivityTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws TException {
922
    throw new UnsupportedOperationException("not implemented");
×
923
  }
924

925
  @Override
926
  public void RecordActivityTaskHeartbeat(
927
      RecordActivityTaskHeartbeatRequest heartbeatRequest, AsyncMethodCallback resultHandler)
928
      throws TException {
929
    throw new UnsupportedOperationException("not implemented");
×
930
  }
931

932
  @Override
933
  public void RecordActivityTaskHeartbeatByID(
934
      RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, AsyncMethodCallback resultHandler)
935
      throws TException {
936
    throw new UnsupportedOperationException("not implemented");
×
937
  }
938

939
  @Override
940
  public void RespondActivityTaskCompleted(
941
      RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler)
942
      throws TException {
943
    throw new UnsupportedOperationException("not implemented");
×
944
  }
945

946
  @Override
947
  public void RespondActivityTaskCompletedByID(
948
      RespondActivityTaskCompletedByIDRequest completeRequest, AsyncMethodCallback resultHandler)
949
      throws TException {
950
    throw new UnsupportedOperationException("not implemented");
×
951
  }
952

953
  @Override
954
  public void RespondActivityTaskFailed(
955
      RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler)
956
      throws TException {
957
    throw new UnsupportedOperationException("not implemented");
×
958
  }
959

960
  @Override
961
  public void RespondActivityTaskFailedByID(
962
      RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler)
963
      throws TException {
964
    throw new UnsupportedOperationException("not implemented");
×
965
  }
966

967
  @Override
968
  public void RespondActivityTaskCanceled(
969
      RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler)
970
      throws TException {
971
    throw new UnsupportedOperationException("not implemented");
×
972
  }
973

974
  @Override
975
  public void RespondActivityTaskCanceledByID(
976
      RespondActivityTaskCanceledByIDRequest canceledRequest, AsyncMethodCallback resultHandler)
977
      throws TException {
978
    throw new UnsupportedOperationException("not implemented");
×
979
  }
980

981
  @Override
982
  public void RequestCancelWorkflowExecution(
983
      RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler)
984
      throws TException {
985
    throw new UnsupportedOperationException("not implemented");
×
986
  }
987

988
  @Override
989
  public void SignalWorkflowExecution(
990
      SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler)
991
      throws TException {
992
    try {
NEW
993
      if (!signalRequest.isSetRequestId()) {
×
NEW
994
        signalRequest.setRequestId(UUID.randomUUID().toString());
×
995
      }
UNCOV
996
      ListenableFuture<com.uber.cadence.api.v1.SignalWorkflowExecutionResponse> resultFuture =
×
997
          grpcServiceStubs
998
              .workflowFutureStub()
×
999
              .signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest));
×
1000
      resultFuture.addListener(
×
1001
          () -> {
1002
            try {
1003
              com.uber.cadence.api.v1.SignalWorkflowExecutionResponse response = resultFuture.get();
×
1004
              resultHandler.onComplete(null);
×
1005
            } catch (Exception e) {
×
1006
              resultHandler.onError(e);
×
1007
            }
×
1008
          },
×
1009
          ForkJoinPool.commonPool());
×
1010
    } catch (StatusRuntimeException e) {
×
1011
      throw ErrorMapper.Error(e);
×
1012
    }
×
1013
  }
×
1014

1015
  @Override
1016
  public void SignalWithStartWorkflowExecution(
1017
      SignalWithStartWorkflowExecutionRequest signalWithStartRequest,
1018
      AsyncMethodCallback resultHandler)
1019
      throws TException {
1020
    throw new UnsupportedOperationException("not implemented");
×
1021
  }
1022

1023
  @Override
1024
  public void SignalWithStartWorkflowExecutionAsync(
1025
      SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest,
1026
      AsyncMethodCallback resultHandler)
1027
      throws TException {
1028
    throw new IllegalArgumentException("unimplemented");
×
1029
  }
1030

1031
  @Override
1032
  public void ResetWorkflowExecution(
1033
      ResetWorkflowExecutionRequest resetRequest, AsyncMethodCallback resultHandler)
1034
      throws TException {
1035
    throw new UnsupportedOperationException("not implemented");
×
1036
  }
1037

1038
  @Override
1039
  public void TerminateWorkflowExecution(
1040
      TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler)
1041
      throws TException {
1042
    throw new UnsupportedOperationException("not implemented");
×
1043
  }
1044

1045
  @Override
1046
  public void ListOpenWorkflowExecutions(
1047
      ListOpenWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler)
1048
      throws TException {
1049
    throw new UnsupportedOperationException("not implemented");
×
1050
  }
1051

1052
  @Override
1053
  public void ListClosedWorkflowExecutions(
1054
      ListClosedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler)
1055
      throws TException {
1056
    throw new UnsupportedOperationException("not implemented");
×
1057
  }
1058

1059
  @Override
1060
  public void ListWorkflowExecutions(
1061
      ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler)
1062
      throws TException {
1063
    throw new UnsupportedOperationException("not implemented");
×
1064
  }
1065

1066
  @Override
1067
  public void ListArchivedWorkflowExecutions(
1068
      ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler)
1069
      throws TException {
1070
    throw new UnsupportedOperationException("not implemented");
×
1071
  }
1072

1073
  @Override
1074
  public void ScanWorkflowExecutions(
1075
      ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler)
1076
      throws TException {
1077
    throw new UnsupportedOperationException("not implemented");
×
1078
  }
1079

1080
  @Override
1081
  public void CountWorkflowExecutions(
1082
      CountWorkflowExecutionsRequest countRequest, AsyncMethodCallback resultHandler)
1083
      throws TException {
1084
    throw new UnsupportedOperationException("not implemented");
×
1085
  }
1086

1087
  @Override
1088
  public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws TException {
1089
    throw new UnsupportedOperationException("not implemented");
×
1090
  }
1091

1092
  @Override
1093
  public void RespondQueryTaskCompleted(
1094
      RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler)
1095
      throws TException {
1096
    throw new UnsupportedOperationException("not implemented");
×
1097
  }
1098

1099
  @Override
1100
  public void ResetStickyTaskList(
1101
      ResetStickyTaskListRequest resetRequest, AsyncMethodCallback resultHandler)
1102
      throws TException {
1103
    throw new UnsupportedOperationException("not implemented");
×
1104
  }
1105

1106
  @Override
1107
  public void QueryWorkflow(QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler)
1108
      throws TException {
1109
    throw new UnsupportedOperationException("not implemented");
×
1110
  }
1111

1112
  @Override
1113
  public void DescribeWorkflowExecution(
1114
      DescribeWorkflowExecutionRequest describeRequest, AsyncMethodCallback resultHandler)
1115
      throws TException {
1116
    throw new UnsupportedOperationException("not implemented");
×
1117
  }
1118

1119
  @Override
1120
  public void DescribeTaskList(DescribeTaskListRequest request, AsyncMethodCallback resultHandler)
1121
      throws TException {
1122
    throw new UnsupportedOperationException("not implemented");
×
1123
  }
1124

1125
  @Override
1126
  public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException {
1127
    throw new UnsupportedOperationException("not implemented");
×
1128
  }
1129

1130
  @Override
1131
  public void GetTaskListsByDomain(
1132
      GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) throws TException {
1133
    throw new UnsupportedOperationException("not implemented");
×
1134
  }
1135

1136
  @Override
1137
  public void ListTaskListPartitions(
1138
      ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws TException {
1139
    throw new UnsupportedOperationException("not implemented");
×
1140
  }
1141

1142
  @Override
1143
  public void RefreshWorkflowTasks(
1144
      RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException {
1145
    throw new UnsupportedOperationException("not implemented");
×
1146
  }
1147

1148
  @Override
1149
  public void close() {
1150
    grpcServiceStubs.shutdownNow();
×
1151
  }
×
1152

1153
  @Override
1154
  public CompletableFuture<Boolean> isHealthy() {
1155
    ListenableFuture<HealthResponse> listenableFuture =
×
1156
        grpcServiceStubs.metaFutureStub().health(HealthRequest.newBuilder().build());
×
1157
    CompletableFuture<Boolean> completable =
×
1158
        new CompletableFuture<Boolean>() {
×
1159
          @Override
1160
          public boolean cancel(boolean mayInterruptIfRunning) {
1161
            boolean result = listenableFuture.cancel(mayInterruptIfRunning);
×
1162
            super.cancel(mayInterruptIfRunning);
×
1163
            return result;
×
1164
          }
1165
        };
1166
    Futures.addCallback(
×
1167
        listenableFuture,
1168
        new FutureCallback<HealthResponse>() {
×
1169
          @Override
1170
          public void onSuccess(HealthResponse result) {
1171
            completable.complete(true);
×
1172
          }
×
1173

1174
          @Override
1175
          public void onFailure(Throwable t) {
1176
            completable.completeExceptionally(t);
×
1177
          }
×
1178
        },
1179
        ForkJoinPool.commonPool());
×
1180
    return completable;
×
1181
  }
1182

1183
  @Override
1184
  public void StartWorkflowExecutionWithTimeout(
1185
      StartWorkflowExecutionRequest startRequest,
1186
      AsyncMethodCallback resultHandler,
1187
      Long timeoutInMillis)
1188
      throws TException {
1189
    try {
1190
      initializeStartWorkflowExecutionRequest(startRequest);
×
1191
      ListenableFuture<com.uber.cadence.api.v1.StartWorkflowExecutionResponse> resultFuture =
×
1192
          grpcServiceStubs
1193
              .workflowFutureStub()
×
1194
              .withDeadline(Deadline.after(timeoutInMillis, TimeUnit.MILLISECONDS))
×
1195
              .startWorkflowExecution(RequestMapper.startWorkflowExecutionRequest(startRequest));
×
1196
      resultFuture.addListener(
×
1197
          () -> {
1198
            try {
1199
              com.uber.cadence.api.v1.StartWorkflowExecutionResponse response = resultFuture.get();
×
1200
              resultHandler.onComplete(ResponseMapper.startWorkflowExecutionResponse(response));
×
1201
            } catch (Exception e) {
×
1202
              resultHandler.onError(e);
×
1203
            }
×
1204
          },
×
1205
          ForkJoinPool.commonPool());
×
1206
    } catch (StatusRuntimeException e) {
×
1207
      throw ErrorMapper.Error(e);
×
1208
    }
×
1209
  }
×
1210

1211
  @Override
1212
  public void StartWorkflowExecutionAsyncWithTimeout(
1213
      StartWorkflowExecutionAsyncRequest startAsyncRequest,
1214
      AsyncMethodCallback resultHandler,
1215
      Long timeoutInMillis)
1216
      throws TException {
1217
    try {
1218
      initializeStartWorkflowExecutionRequest(startAsyncRequest.getRequest());
×
1219
      ListenableFuture<com.uber.cadence.api.v1.StartWorkflowExecutionAsyncResponse> resultFuture =
×
1220
          grpcServiceStubs
1221
              .workflowFutureStub()
×
1222
              .withDeadline(Deadline.after(timeoutInMillis, TimeUnit.MILLISECONDS))
×
1223
              .startWorkflowExecutionAsync(
×
1224
                  RequestMapper.startWorkflowExecutionAsyncRequest(startAsyncRequest));
×
1225
      resultFuture.addListener(
×
1226
          () -> {
1227
            try {
1228
              com.uber.cadence.api.v1.StartWorkflowExecutionAsyncResponse response =
×
1229
                  resultFuture.get();
×
1230
              resultHandler.onComplete(
×
1231
                  ResponseMapper.startWorkflowExecutionAsyncResponse(response));
×
1232
            } catch (Exception e) {
×
1233
              resultHandler.onError(e);
×
1234
            }
×
1235
          },
×
1236
          ForkJoinPool.commonPool());
×
1237
    } catch (StatusRuntimeException e) {
×
1238
      throw ErrorMapper.Error(e);
×
1239
    }
×
1240
  }
×
1241

1242
  @Override
1243
  public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout(
1244
      GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws TException {
1245
    try {
1246
      com.uber.cadence.api.v1.GetWorkflowExecutionHistoryResponse response =
×
1247
          grpcServiceStubs
1248
              .workflowBlockingStub()
×
1249
              .withDeadline(Deadline.after(timeoutInMillis, TimeUnit.MILLISECONDS))
×
1250
              .getWorkflowExecutionHistory(
×
1251
                  RequestMapper.getWorkflowExecutionHistoryRequest(getRequest));
×
1252
      return ResponseMapper.getWorkflowExecutionHistoryResponse(response);
×
1253
    } catch (StatusRuntimeException e) {
×
1254
      throw ErrorMapper.Error(e);
×
1255
    }
1256
  }
1257

1258
  @Override
1259
  public void GetWorkflowExecutionHistoryWithTimeout(
1260
      GetWorkflowExecutionHistoryRequest getRequest,
1261
      AsyncMethodCallback resultHandler,
1262
      Long timeoutInMillis)
1263
      throws TException {
1264
    try {
1265
      ListenableFuture<com.uber.cadence.api.v1.GetWorkflowExecutionHistoryResponse> resultFuture =
×
1266
          grpcServiceStubs
1267
              .workflowFutureStub()
×
1268
              .withDeadline(Deadline.after(timeoutInMillis, TimeUnit.MILLISECONDS))
×
1269
              .getWorkflowExecutionHistory(
×
1270
                  RequestMapper.getWorkflowExecutionHistoryRequest(getRequest));
×
1271
      resultFuture.addListener(
×
1272
          () -> {
1273
            try {
1274
              com.uber.cadence.api.v1.GetWorkflowExecutionHistoryResponse response =
×
1275
                  resultFuture.get();
×
1276
              resultHandler.onComplete(
×
1277
                  ResponseMapper.getWorkflowExecutionHistoryResponse(response));
×
1278
            } catch (Exception e) {
×
1279
              resultHandler.onError(e);
×
1280
            }
×
1281
          },
×
1282
          ForkJoinPool.commonPool());
×
1283
    } catch (StatusRuntimeException e) {
×
1284
      throw ErrorMapper.Error(e);
×
1285
    }
×
1286
  }
×
1287

1288
  @Override
1289
  public void SignalWorkflowExecutionWithTimeout(
1290
      SignalWorkflowExecutionRequest signalRequest,
1291
      AsyncMethodCallback resultHandler,
1292
      Long timeoutInMillis)
1293
      throws TException {
1294
    throw new UnsupportedOperationException("not implemented");
×
1295
  }
1296
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc