'Process Individual message with Durable Function

I am working on a project which gets change notifications through Event Hubs(https://docs.microsoft.com/en-us/graph/change-notifications-delivery).

My Azure Function(Event Receiver) receives the events in batches. After receiving each batch, it processes the data (does a bit of work) and sets a variable. The second batch comes in takes the value from the variable does some processing and updates the variable and so on.

The Event Hub has 3 partitions.

The problem arises when multiples batches arrives at the same time. The second batch comes in before the first batch has updated the variable.

Is it possible to use a durable function to achieve a sequential processing? I read about the LockAsync(), is it possible to achieve it with that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source