microsoft / durabletask-java

Java SDK for Durable Functions and the Durable Task Framework
MIT License
13 stars 7 forks source link

DurableClientContext.createCheckStatusResponse status code #92

Closed jeffphilp closed 1 year ago

jeffphilp commented 1 year ago

Hi, I have a project which invokes a durable function from a logic app (through a http handler), and when using this approach against a durable function written in C# the logic app Asynchronous Pattern processing is able to poll the status because the orchestrator code returns a response with status code set to 202 (see doc https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.webjobs.extensions.durabletask.idurableorchestrationclient.createcheckstatusresponse?view=azure-dotnet#microsoft-azure-webjobs-extensions-durabletask-idurableorchestrationclient-createcheckstatusresponse(system-net-http-httprequestmessage-system-string-system-boolean)).

Returns
[HttpResponseMessage](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpresponsemessage)
An HTTP 202 response with a Location header and a payload containing instance control URLs.

However when the logic app is pointed towards a durable function written in Java, the DurableClientContext.createCheckStatusResponse is returning a response with a status code of 201 (https://github.com/microsoft/durabletask-java/blob/6fd01c1cc5e1bedf384ae908d0d0a10797432871/azurefunctions/src/main/java/com/microsoft/durabletask/azurefunctions/DurableClientContext.java#L74) which means the logic app doesn't poll for progress and immediately continues.

My query was should this function be returning the status code set as 202 to be consistent with the .NET sdk?

cgillum commented 1 year ago

Yes, I think this is a bug. This should be returning a 202, not a 201.