Can we use callbacks in an azure functions

can we use callbacks in azure functions, we are able to achieve the same using the webapi, but wanted to check if we do it via azure functions.

A common use case is introducing messaging to existing synchronous web or WCF applications.

Don’t do that. Functions are supposed to be short lived and mostly asynchronous in their nature. If you need callbacks, check your design or use the appropriate technology to host your code.

1 Like

Hey @SeanFeldman, can we use callbacks in durable functions ?

@Nen_Zax could you start from what are you trying to do, or what problem you’re solving? Starting with a technology resembles to a cart in front of the horse. You can do it but should you?

hey Sean,

we have a scenario where we start our message flow with an event PurchaseRequest and after few commands and events, we finally publish another event PurchaseCompleted.

But one of our clients need a synchronous way of executing this, they want to wait for the flow to complete.

Client <–>SyncAPI<–>PurchaseFlow.

Questions :

  1. From what i have understood so far, we need Commands and replies for callbacks to work. As our process starts of with a Event and ends with an event we cannot leverage CallBacks. Is this correct ?

  2. We can change PurchaseRequest to a command, but for the process to complete it requires interaction with other Endpoints where there are commands and events, so callbacks cannot work here, is our assumption correct ?

One of the solution that we thought is to use Durable Functions as the sync wrapper which will “WaitForExternalEvent” (PurchaseCompleted) and then send a response out.

Or is there way to achieve the same with callbacks ?

Thanks -nen

The client is the one that is registering a callback. And the client initiating the process is not a Function but rather a web application that can register callbacks that stay around, then a response message will be processed by the client’s callback. From a function point of you, it would just respond to the incoming message.