I have two Azure AppService slots -- staging and production -- that are each pulling messages from the same Azure EventHub Instance.
When only one slot is active, everything works as expected. However, if I have both slots active, they seem to compete for the same messages, and the state gets shared between the two slots unpredictably. As a result, staging will have some messages, and production will have others. This leads to unexpected and undesired behavior.
As an example, given messages A
, B
, and C
, what currently appears to happen is:
Staging: A
, C
Production: B
What I want is:
Staging: A
, B
, C
Production: A
, B
, C
How do I configure Azure Event Hubs to achieve the desired processing? For additional context, I am using .NET/C# and the Azure.Messaging.EventHubs.Processor
nuget package.
So, you are looking for a solution in which both slots process the same messages from an Event Hub? If so, your solution would be to use a different Consumer Group per slot:
Take a look at this code example showing how to configure the processor to use a specific consumer group.