Azure Function Event Hub Trigger one batch at a time

Newbie Dev 151 Reputation points
2022-03-07T14:41:49.733+00:00

I am working on a project which gets change notifications through Event Hubs(https://learn.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). The second batch updates the value set by the first batch.

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 value.

Is there a way to receive only one batch at a time?

I am not bothered about the order of batches, but I want to get the next batch trigger only after the first batch is processed.

Thanks in advance.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,029 questions
Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
643 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruno Lucas 6 Reputation points
    2022-03-08T02:04:36.4+00:00

    Are you trying to get something like FIFO (First In, First Out)?

    Check this out: https://medium.com/@jeffhollan/in-order-event-processing-with-azure-functions-bb661eb55428

    180854-image.png

    180768-image.png


  2. MughundhanRaveendran-MSFT 12,481 Reputation points
    2022-03-08T14:15:24.03+00:00

    @Newbie Dev ,

    @Bruno Lucas has answered most part of the question. Thanks to you @Bruno Lucas

    Additionally you can try to set the cardinality to one in the function.json and test it at your end.

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs-trigger?tabs=csharp#configuration


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.