title: Azure event hubs and multiple consumer groups
body: <p>Need help on using Azure event hubs in the following scenario. I think consumer groups might be the right option for this scenario, but I was not able to find a concrete example online.</p>
  
  <p>Here is the rough description of the problem and the proposed solution using the event hubs (<strong>I am not sure if this is the optimal solution. Will appreciate your feedback</strong>)</p>
  
  <p><img src="https://i.stack.imgur.com/hfpHD.png" alt="enter image description here"></p>
  
  <p>I have multiple event-sources that generate a lot of event data (telemetry data from sensors) which needs to be saved to our database and some analysis like running average, min-max should be performed in <strong>parallel</strong>.</p>
  
  <p>The sender can only send data to a single endpoint, but the event-hub should make this data available to both the data handlers.</p>
  
  <p>I am thinking about using two consumer groups, first one will be a cluster of worker role instances that take care of saving the data to our key-value store and the second consumer group will be an analysis engine (likely to go with Azure Stream Analysis).</p>
  
  <p>Firstly, how do I setup the consumer groups and is there something that I need to do on the sender/receiver side such that copies of events appear on all consumer groups? </p>
  
  <p>I did read many examples online, but they either use <code>client.GetDefaultConsumerGroup();</code> and/or have all partitions processed by multiple instances of a same worker role. </p>
  
  <p>For my scenario, when a event is triggered, it needs to be processed by two different worker roles in parallel (one that saves the data and second one that does some analysis)</p>
  
  <p>Thank You!</p>