Skip to content

Commit 0bceff0

Browse files
committed
Added param timeoutMillis to signal operation and signalTimeout to SignalResponse
1 parent 3c51139 commit 0bceff0

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

orkes-client/src/main/java/io/orkes/conductor/client/http/OrkesTaskClient.java

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,40 @@ public SignalResponse signal(String workflowId, Task.Status status, Map<String,
154154
* @return SignalResponse with data based on the return strategy
155155
*/
156156
public SignalResponse signal(String workflowId, Task.Status status, Map<String, Object> output, ReturnStrategy returnStrategy) {
157-
ConductorClientRequest request = ConductorClientRequest.builder()
157+
return signal(workflowId, status, output, returnStrategy, null);
158+
}
159+
160+
/**
161+
* Signals a task in a workflow synchronously and returns data based on the specified return strategy.
162+
*
163+
* @param workflowId Workflow Id of the workflow to be signaled
164+
* @param status Signal status to be set for the workflow
165+
* @param output Output for the task
166+
* @param returnStrategy Strategy for what data to return
167+
* @param timeoutMillis Timeout in milliseconds
168+
* @return SignalResponse with data based on the return strategy
169+
*/
170+
public SignalResponse signal(String workflowId,
171+
Task.Status status,
172+
Map<String, Object> output,
173+
ReturnStrategy returnStrategy,
174+
Long timeoutMillis) {
175+
var builder = ConductorClientRequest.builder()
158176
.method(ConductorClientRequest.Method.POST)
159177
.path("/tasks/{workflowId}/{status}/signal/sync")
160178
.addPathParam("workflowId", workflowId)
161179
.addPathParam("status", status.name())
162180
.addQueryParam("returnStrategy", returnStrategy.name())
163-
.body(output)
164-
.build();
181+
.body(output);
182+
183+
if (timeoutMillis != null) {
184+
builder.addQueryParam("timeoutMillis", timeoutMillis.toString());
185+
}
165186

166-
ConductorClientResponse<SignalResponse> resp = client.execute(request, new TypeReference<SignalResponse>() {
187+
var request = builder.build();
188+
var resp = client.execute(request, new TypeReference<SignalResponse>() {
167189
});
190+
168191
return resp.getData();
169192
}
170193

orkes-client/src/main/java/io/orkes/conductor/client/model/SignalResponse.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class SignalResponse {
3939
private Map<String, Object> output;
4040
private Integer priority;
4141
private Map<String, Object> variables;
42+
private boolean signalTimeout;
4243

4344
// Fields specific to TARGET_WORKFLOW & BLOCKING_WORKFLOW
4445
private List<Task> tasks;

0 commit comments

Comments
 (0)