Use-case of Azure Event Hub Consumer Group

Asiful Nobel 196 Reputation points
2021-06-20T14:07:24.373+00:00

Can someone explain what is the point of having multiple consumer groups vs single consumer group in an Event Hub instance? I checked the Microsoft Learn on this topic, but did not get an answer. It says that consumer groups let multiple applications to each have a separate view. But it does not show anywhere how that is done.

For example, imagine a scenario where there are 4 applications (all are single instance) consuming from the same Event Hub instance. All 4 apps will be able to read all message from the Event Hub regardless of whether the apps are using one consumer group or four, right?

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
637 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. HimanshuSinha-msft 19,476 Reputation points Microsoft Employee
    2021-06-21T23:08:14.927+00:00

    Hello @Asiful Nobel ,
    Thanks for the ask and using the Microsoft Q&A platform . I think you are missing the point you can write the events to a particular partition(s) and label a consumer group to that . The below diagram shoukld help .
    107821-image.png

    This link should also make things more clear .

    Please do let me know how it goes .
    Thanks
    Himanshu
    Please do consider clicking on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members


  2. Serkant Karaca 21 Reputation points Microsoft Employee
    2021-06-24T00:46:47.62+00:00

    I think it is easier to describe it with an example. Let's say there is an eventhub providing some purchase order notifications and you need to process messages from that in 2 different pipelines. One for telemetry that needs to consume messages near real time as they arrive; this may well be a job to send an email notification to customers when order state changes. Then, 2nd pipeline where processor collects telemetry like data which can run every once in a while (batch processing) and write statistical data to some downstream system. As you can see, in this scenario you need to track checkpoints separately, one for notification processor and one for telemetry processor. Each processor needs to know the position of the last message they processed so they can resume the process in case of a failure or system restart. Consumer groups come into play to isolate consumers in such scenarios where consumer behavior or code starts differentiating. In other words each group of consumer runs with its own consumer-group so they don't step on each other's toe.


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.