@@ -31,6 +31,8 @@ public static NexusOperationOptions getDefaultInstance() {
3131
3232 public static final class Builder {
3333 private Duration scheduleToCloseTimeout ;
34+ private Duration scheduleToStartTimeout ;
35+ private Duration startToCloseTimeout ;
3436 private NexusOperationCancellationType cancellationType ;
3537 private String summary ;
3638
@@ -46,6 +48,45 @@ public NexusOperationOptions.Builder setScheduleToCloseTimeout(
4648 return this ;
4749 }
4850
51+ /**
52+ * Sets the schedule to start timeout for the Nexus operation.
53+ *
54+ * <p>Maximum time to wait for the operation to be started (or completed if synchronous) by the
55+ * handler. If the operation is not started within this timeout, it will fail with
56+ * TIMEOUT_TYPE_SCHEDULE_TO_START.
57+ *
58+ * <p>Requires Temporal Server 1.31.0 or later.
59+ *
60+ * @param scheduleToStartTimeout the schedule to start timeout for the Nexus operation
61+ * @return this
62+ */
63+ @ Experimental
64+ public NexusOperationOptions .Builder setScheduleToStartTimeout (
65+ Duration scheduleToStartTimeout ) {
66+ this .scheduleToStartTimeout = scheduleToStartTimeout ;
67+ return this ;
68+ }
69+
70+ /**
71+ * Sets the start to close timeout for the Nexus operation.
72+ *
73+ * <p>Maximum time to wait for an asynchronous operation to complete after it has been started.
74+ * If the operation does not complete within this timeout after starting, it will fail with
75+ * TIMEOUT_TYPE_START_TO_CLOSE.
76+ *
77+ * <p>Only applies to asynchronous operations. Synchronous operations ignore this timeout.
78+ *
79+ * <p>Requires Temporal Server 1.31.0 or later.
80+ *
81+ * @param startToCloseTimeout the start to close timeout for the Nexus operation
82+ * @return this
83+ */
84+ @ Experimental
85+ public NexusOperationOptions .Builder setStartToCloseTimeout (Duration startToCloseTimeout ) {
86+ this .startToCloseTimeout = startToCloseTimeout ;
87+ return this ;
88+ }
89+
4990 /**
5091 * Sets the cancellation type for the Nexus operation. Defaults to WAIT_COMPLETED.
5192 *
@@ -78,12 +119,19 @@ private Builder(NexusOperationOptions options) {
78119 return ;
79120 }
80121 this .scheduleToCloseTimeout = options .getScheduleToCloseTimeout ();
122+ this .scheduleToStartTimeout = options .getScheduleToStartTimeout ();
123+ this .startToCloseTimeout = options .getStartToCloseTimeout ();
81124 this .cancellationType = options .getCancellationType ();
82125 this .summary = options .getSummary ();
83126 }
84127
85128 public NexusOperationOptions build () {
86- return new NexusOperationOptions (scheduleToCloseTimeout , cancellationType , summary );
129+ return new NexusOperationOptions (
130+ scheduleToCloseTimeout ,
131+ scheduleToStartTimeout ,
132+ startToCloseTimeout ,
133+ cancellationType ,
134+ summary );
87135 }
88136
89137 public NexusOperationOptions .Builder mergeNexusOperationOptions (
@@ -95,6 +143,14 @@ public NexusOperationOptions.Builder mergeNexusOperationOptions(
95143 (override .scheduleToCloseTimeout == null )
96144 ? this .scheduleToCloseTimeout
97145 : override .scheduleToCloseTimeout ;
146+ this .scheduleToStartTimeout =
147+ (override .scheduleToStartTimeout == null )
148+ ? this .scheduleToStartTimeout
149+ : override .scheduleToStartTimeout ;
150+ this .startToCloseTimeout =
151+ (override .startToCloseTimeout == null )
152+ ? this .startToCloseTimeout
153+ : override .startToCloseTimeout ;
98154 this .cancellationType =
99155 (override .cancellationType == null ) ? this .cancellationType : override .cancellationType ;
100156 this .summary = (override .summary == null ) ? this .summary : override .summary ;
@@ -104,9 +160,13 @@ public NexusOperationOptions.Builder mergeNexusOperationOptions(
104160
105161 private NexusOperationOptions (
106162 Duration scheduleToCloseTimeout ,
163+ Duration scheduleToStartTimeout ,
164+ Duration startToCloseTimeout ,
107165 NexusOperationCancellationType cancellationType ,
108166 String summary ) {
109167 this .scheduleToCloseTimeout = scheduleToCloseTimeout ;
168+ this .scheduleToStartTimeout = scheduleToStartTimeout ;
169+ this .startToCloseTimeout = startToCloseTimeout ;
110170 this .cancellationType = cancellationType ;
111171 this .summary = summary ;
112172 }
@@ -116,13 +176,25 @@ public NexusOperationOptions.Builder toBuilder() {
116176 }
117177
118178 private final Duration scheduleToCloseTimeout ;
179+ private final Duration scheduleToStartTimeout ;
180+ private final Duration startToCloseTimeout ;
119181 private final NexusOperationCancellationType cancellationType ;
120182 private final String summary ;
121183
122184 public Duration getScheduleToCloseTimeout () {
123185 return scheduleToCloseTimeout ;
124186 }
125187
188+ @ Experimental
189+ public Duration getScheduleToStartTimeout () {
190+ return scheduleToStartTimeout ;
191+ }
192+
193+ @ Experimental
194+ public Duration getStartToCloseTimeout () {
195+ return startToCloseTimeout ;
196+ }
197+
126198 public NexusOperationCancellationType getCancellationType () {
127199 return cancellationType ;
128200 }
@@ -138,20 +210,31 @@ public boolean equals(Object o) {
138210 if (o == null || getClass () != o .getClass ()) return false ;
139211 NexusOperationOptions that = (NexusOperationOptions ) o ;
140212 return Objects .equals (scheduleToCloseTimeout , that .scheduleToCloseTimeout )
213+ && Objects .equals (scheduleToStartTimeout , that .scheduleToStartTimeout )
214+ && Objects .equals (startToCloseTimeout , that .startToCloseTimeout )
141215 && Objects .equals (cancellationType , that .cancellationType )
142216 && Objects .equals (summary , that .summary );
143217 }
144218
145219 @ Override
146220 public int hashCode () {
147- return Objects .hash (scheduleToCloseTimeout , cancellationType , summary );
221+ return Objects .hash (
222+ scheduleToCloseTimeout ,
223+ scheduleToStartTimeout ,
224+ startToCloseTimeout ,
225+ cancellationType ,
226+ summary );
148227 }
149228
150229 @ Override
151230 public String toString () {
152231 return "NexusOperationOptions{"
153232 + "scheduleToCloseTimeout="
154233 + scheduleToCloseTimeout
234+ + ", scheduleToStartTimeout="
235+ + scheduleToStartTimeout
236+ + ", startToCloseTimeout="
237+ + startToCloseTimeout
155238 + ", cancellationType="
156239 + cancellationType
157240 + ", summary='"
0 commit comments