@@ -136,7 +136,17 @@ public void startAndBlock() {
136136 .setCustomStatus (StringValue .of (taskOrchestratorResult .getCustomStatus ()))
137137 .build ();
138138
139- this .sidecarClient .completeOrchestratorTask (response );
139+ try {
140+ this .sidecarClient .completeOrchestratorTask (response );
141+ } catch (StatusRuntimeException e ) {
142+ if (e .getStatus ().getCode () == Status .Code .UNAVAILABLE ) {
143+ logger .log (Level .WARNING , "The sidecar at address {0} is unavailable while completing the orchestrator task." , this .getSidecarAddress ());
144+ } else if (e .getStatus ().getCode () == Status .Code .CANCELLED ) {
145+ logger .log (Level .WARNING , "Durable Task worker has disconnected from {0} while completing the orchestrator task." , this .getSidecarAddress ());
146+ } else {
147+ logger .log (Level .WARNING , "Unexpected failure completing the orchestrator task at {0}." , this .getSidecarAddress ());
148+ }
149+ }
140150 });
141151 } else if (requestType == RequestCase .ACTIVITYREQUEST ) {
142152 ActivityRequest activityRequest = workItem .getActivityRequest ();
@@ -169,7 +179,17 @@ public void startAndBlock() {
169179 responseBuilder .setFailureDetails (failureDetails );
170180 }
171181
172- this .sidecarClient .completeActivityTask (responseBuilder .build ());
182+ try {
183+ this .sidecarClient .completeActivityTask (responseBuilder .build ());
184+ } catch (StatusRuntimeException e ) {
185+ if (e .getStatus ().getCode () == Status .Code .UNAVAILABLE ) {
186+ logger .log (Level .WARNING , "The sidecar at address {0} is unavailable while completing the activity task." , this .getSidecarAddress ());
187+ } else if (e .getStatus ().getCode () == Status .Code .CANCELLED ) {
188+ logger .log (Level .WARNING , "Durable Task worker has disconnected from {0} while completing the activity task." , this .getSidecarAddress ());
189+ } else {
190+ logger .log (Level .WARNING , "Unexpected failure completing the activity task at {0}." , this .getSidecarAddress ());
191+ }
192+ }
173193 });
174194 } else {
175195 logger .log (Level .WARNING , "Received and dropped an unknown '{0}' work-item from the sidecar." , requestType );
0 commit comments