You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @returnametadatarecordthatdescribestheorchestrationinstanceanditsexecutionstatus, or
* <code>null</code> ifnosuchinstanceisfound.
*/
@NullablepublicabstractOrchestrationMetadatagetInstanceMetadata(StringinstanceId, booleangetInputsAndOutputs);
However, In that case, I found that DurableTaskGrpcClient.getInstanceMetadata returns DEFAULT_INSTANCE with orchestrationState_=0 (ORCHESTRATION_STATUS_RUNNING).
This issue prevents us from invoking client.scheduleNewOrchestrationInstance in Singleton pattern described the official document here. That also means the library users cannot tell the accurate state of instance.
@FunctionName("HttpStartSingle")
publicHttpResponseMessagerunSingle(
@HttpTrigger(name = "req") HttpRequestMessage<?> req,
@DurableClientInput(name = "durableContext") DurableClientContextdurableContext) {
StringinstanceID = "StaticID";
DurableTaskClientclient = durableContext.getClient();
// Check to see if an instance with this ID is already runningOrchestrationMetadatametadata = client.getInstanceMetadata(instanceID, false);
if (metadata.isRunning()) {
returnreq.createResponseBuilder(HttpStatus.CONFLICT)
.body("An instance with ID '" + instanceID + "' already exists.")
.build();
}
// No such instance exists - create a new one. De-dupe is handled automatically// in the storage layer if another function tries to also use this instance ID.client.scheduleNewOrchestrationInstance("MyOrchestration", null, instanceID);
returndurableContext.createCheckStatusResponse(req, instanceID);
}
The text was updated successfully, but these errors were encountered:
Regarding the API, getInstanceMetadata should return null when there are no instances found.
durabletask-java/client/src/main/java/com/microsoft/durabletask/DurableTaskClient.java
Line 128 in bfbd7a8
However, In that case, I found that DurableTaskGrpcClient.getInstanceMetadata returns DEFAULT_INSTANCE with orchestrationState_=0 (ORCHESTRATION_STATUS_RUNNING).
// Protobuf code.
This issue prevents us from invoking client.scheduleNewOrchestrationInstance in Singleton pattern described the official document here. That also means the library users cannot tell the accurate state of instance.
https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-singletons?tabs=java#singleton-example
The text was updated successfully, but these errors were encountered: