@@ -71,8 +71,10 @@ public HttpResponseMessage startRewindableOrchestration(
7171
7272 /**
7373 * HTTP trigger that starts a non-failing orchestration, waits for it to complete,
74- * then attempts to rewind it using client.rewindInstance(). Returns the check status
75- * response so the caller can verify the orchestration remains in the Completed state.
74+ * then attempts to rewind it using client.rewindInstance(). The sidecar should reject
75+ * the rewind with FAILED_PRECONDITION (translated to IllegalStateException) since
76+ * the instance is not in a Failed state. Returns 200 with the exception message on
77+ * expected rejection, or 500 if the rewind unexpectedly succeeded.
7678 */
7779 @ FunctionName ("StartRewindNonFailedOrchestration" )
7880 public HttpResponseMessage startRewindNonFailedOrchestration (
@@ -104,12 +106,16 @@ public HttpResponseMessage startRewindNonFailedOrchestration(
104106 // in a Failed state. The client translates this to an IllegalStateException.
105107 try {
106108 client .rewindInstance (instanceId , "Testing rewind on non-failed orchestration" );
107- context .getLogger ().info ("Rewind request sent for non-failed instance: " + instanceId );
109+ // If we get here, the rewind did not throw as expected
110+ return request .createResponseBuilder (com .microsoft .azure .functions .HttpStatus .INTERNAL_SERVER_ERROR )
111+ .body ("IllegalStateException was not thrown for non-failed instance" )
112+ .build ();
108113 } catch (IllegalStateException e ) {
109114 context .getLogger ().info ("Rewind on non-failed instance was rejected (expected): " + e .getMessage ());
115+ return request .createResponseBuilder (com .microsoft .azure .functions .HttpStatus .OK )
116+ .body (e .getMessage ())
117+ .build ();
110118 }
111-
112- return durableContext .createCheckStatusResponse (request , instanceId );
113119 }
114120
115121 /**
0 commit comments