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

temporalio / sdk-java / #169

pending completion
#169

push

github-actions

web-flow
Remove use of deprecated API (#1758)

4 of 4 new or added lines in 1 file covered. (100.0%)

17345 of 21558 relevant lines covered (80.46%)

0.8 hits per line

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

73.68
/temporal-sdk/src/main/java/io/temporal/internal/worker/WorkflowTaskHandler.java
1
/*
2
 * Copyright (C) 2022 Temporal Technologies, Inc. All Rights Reserved.
3
 *
4
 * Copyright (C) 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
 *
6
 * Modifications copyright (C) 2017 Uber Technologies, Inc.
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this material except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *   http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20

21
package io.temporal.internal.worker;
22

23
import io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse;
24
import io.temporal.api.workflowservice.v1.RespondQueryTaskCompletedRequest;
25
import io.temporal.api.workflowservice.v1.RespondWorkflowTaskCompletedRequest;
26
import io.temporal.api.workflowservice.v1.RespondWorkflowTaskFailedRequest;
27
import io.temporal.serviceclient.RpcRetryOptions;
28
import io.temporal.workflow.Functions;
29

30
/**
31
 * Interface of workflow task handlers.
32
 *
33
 * @author fateev, suskin
34
 */
35
public interface WorkflowTaskHandler {
36

37
  final class Result {
38
    private final String workflowType;
39
    private final RespondWorkflowTaskCompletedRequest taskCompleted;
40
    private final RespondWorkflowTaskFailedRequest taskFailed;
41
    private final RespondQueryTaskCompletedRequest queryCompleted;
42
    private final RpcRetryOptions requestRetryOptions;
43
    private final boolean completionCommand;
44
    private final Functions.Proc1<Long> eventIdSetHandle;
45

46
    public Result(
47
        String workflowType,
48
        RespondWorkflowTaskCompletedRequest taskCompleted,
49
        RespondWorkflowTaskFailedRequest taskFailed,
50
        RespondQueryTaskCompletedRequest queryCompleted,
51
        RpcRetryOptions requestRetryOptions,
52
        boolean completionCommand,
53
        Functions.Proc1<Long> eventIdSetHandle) {
1✔
54
      this.workflowType = workflowType;
1✔
55
      this.taskCompleted = taskCompleted;
1✔
56
      this.taskFailed = taskFailed;
1✔
57
      this.queryCompleted = queryCompleted;
1✔
58
      this.requestRetryOptions = requestRetryOptions;
1✔
59
      this.completionCommand = completionCommand;
1✔
60
      this.eventIdSetHandle = eventIdSetHandle;
1✔
61
    }
1✔
62

63
    public RespondWorkflowTaskCompletedRequest getTaskCompleted() {
64
      return taskCompleted;
1✔
65
    }
66

67
    public RespondWorkflowTaskFailedRequest getTaskFailed() {
68
      return taskFailed;
1✔
69
    }
70

71
    public RespondQueryTaskCompletedRequest getQueryCompleted() {
72
      return queryCompleted;
1✔
73
    }
74

75
    public RpcRetryOptions getRequestRetryOptions() {
76
      return requestRetryOptions;
1✔
77
    }
78

79
    public boolean isCompletionCommand() {
80
      return completionCommand;
1✔
81
    }
82

83
    public Functions.Proc1<Long> getEventIdSetHandle() {
84
      if (eventIdSetHandle != null) {
×
85
        return eventIdSetHandle;
×
86
      }
87
      return (arg) -> {};
×
88
    }
89

90
    @Override
91
    public String toString() {
92
      return "Result{"
×
93
          + "workflowType='"
94
          + workflowType
95
          + '\''
96
          + ", taskCompleted="
97
          + taskCompleted
98
          + ", taskFailed="
99
          + taskFailed
100
          + ", queryCompleted="
101
          + queryCompleted
102
          + ", requestRetryOptions="
103
          + requestRetryOptions
104
          + ", completionCommand="
105
          + completionCommand
106
          + '}';
107
    }
108

109
    public String getWorkflowType() {
110
      return workflowType;
×
111
    }
112
  }
113

114
  /**
115
   * Handles a single workflow task
116
   *
117
   * @param workflowTask The workflow task to handle.
118
   * @return One of the possible workflow task replies: RespondWorkflowTaskCompletedRequest,
119
   *     RespondQueryTaskCompletedRequest, RespondWorkflowTaskFailedRequest
120
   * @throws Exception an original exception or error if the processing should be just abandoned
121
   *     without replying to the server
122
   */
123
  Result handleWorkflowTask(PollWorkflowTaskQueueResponse workflowTask) throws Exception;
124

125
  /** True if this handler handles at least one workflow type. */
126
  boolean isAnyTypeSupported();
127
}
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