dsun
dsun

Reputation: 63

Question regarding multiple Orchestration functions calling one Entity

I was wondering if anyone could help me understand some behavior regarding orchestration functions and entities.

Say I have one HttpTriggered function that starts an orchestration that calls (not signal) a Durable Entity and runs a long process (30 seconds) to update some string member. I also have another HttpTriggered function that starts an orchestration to call the same Entity and get that string.

What I want to know is that if I trigger the first function "A" and then the second function "B" immediately after. When "B" calls the Entity to get the string, does it wait for "A" to finish its call to the Entity? Or will "B" get a "dirty" value from it?

Guess what I'm trying to figure out is if all calls to the Entity have to be synchronous in regards to the Control Queue.

Upvotes: 4

Views: 810

Answers (1)

Chris Gillum
Chris Gillum

Reputation: 15052

Entities execute operations one-at-a-time in FIFO order, so if you have two orchestrations (A and B) that call some operation simultaneously, the second operation (B in your example) will be forced to wait for A's operation to finish, which could be as long as 30 seconds. Dirty reads therefore aren't possible when calling entities. This synchronization happens in memory in the Durable Functions extension itself.

This is mentioned in the documentation here: https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-entities#general-concepts

To prevent conflicts, all operations on a single entity are guaranteed to execute serially, that is, one after another.

This applies both to entity calls and signals.

Upvotes: 3

Related Questions